News for hackers. Stuff that matters.

alldaysintoone

The above experience is production experience where the decision to use JSDocs allowed us to focus on features over a TS rewrite, maintaining two codebases for multiple years with that strategy whilst vastly improving the type safety and documentation - from no types to full coverage and validation on the backend.

And prior to my current role I've used TS in production too.

Your response is exactly the sort of snap decision that I might have experienced.

And it's one that I find confusing in light of passion for type safety and type checking.

You wouldn't implement an interface per say. You would implement a JSDoc type annotation which you can then attach to a doc string for a function input or return.

Next time you try to use that function the tooling (VS Code) will highlight the Type required by it as both documentation and a dynamic check - this fn input is missing X property.

Imagine it as a TS light version, where tooling and docs helps you write well-documented typed code that isn't checked for validity at compilation.

All the logic that is important is typed: all inputs, outputs. Each function is documented in terms of the program IO and what it should do and why (description).

There's no typed guard rails in place. You could pass an object that doesnt follow a type, but with team agreements, reviews, testing, and diligence you wouldn't. In TS you bypass process because the compiler does those checks for you.

To actually force runtime compliance to types and further get to a statically typed vision I used object validation schema. Each complex fn input would have a schema and we would validate against that.

In such a way you have some typing, documentation, and some static typing.

Since JS was never build with types or static typing as a first class citizen (like other languages are) there's less friction in scenarios where JS is too multifaceted or loose. This is the "have your cake and ear it" reply: you have types, documentation, runtime type checks for what matters, but you stay native to JS and avoid full static typing, remove the need for TS compiler.

Ask HN: Why do interviewers hate anti-TypeScript opinions?

Hello HN,I'm an experienced web dev and I've recently been interviewing for new fullstack role.# backgroundPrevious role I used TS everyday for all types of developement: api development and frontend via React.In my current role I inherited an non-typed codebase and I decided to use JSDocs vs Typescript.I made that decision because I knew that our older monolith framework and setup would cause...

( Read More... | 47 comments | 2 points | on HN )
I’m not a Spanish speaker, but Marcia Villalba is one of my favourite Serverless YouTubers and bloggers.

They also have Spanish-only playlists

https://m.youtube.com/@foobar_codes

Ask HN: Experienced Node/React developer should I take a Django job?

I'm a Node/React dev with 3years experience.I've been getting into Python because of ML and I've recently been offered a role that works with Django, real-time data, and very basic frontend via Bootstrap.Just wanted to gather opinions on Django the stack. Would love to increase my tech knowledge with this so it could be interesting.

( Read More... | 1 comment | 2 points | on HN )