DEV Community

Discussion on: Sell Me On Typescript

Collapse
 
peerreynders profile image
peerreynders • Edited

I'm not particularly fond of TypeScript - overall I view it as having poor ROI but decided to learn it anyway so that I could at least have a somewhat coherent base to criticize it from.

That said I accidentally fell into an interesting work flow. I was trying to use uvu with TypeScript. It uses tsm to test TypeScript code.

With that setup you can actually focus entirely on getting your unit tests done first without paying any attention to TypeScript - type checking (linting) only occasionally when the test results don't make any sense (i.e. overall the tests where more effective pointing out issues than TypeScript).

Once you're done with a unit of work you can then focus on what TypeScript is complaining about - "oh yeah, I better clean that up".

That allows a "JavaScript style" work flow with (a sprinkling of) explicit TypeScript types for documentation.

Basically use fast non-checking transpilation with a fast loader for reqular work and only run the full type check at the end or when things get weird.

Thread Thread
 
psypher1 profile image
James 'Dante' Midzi

This is realty interesting... Is there a public repo I can look at?

Thread Thread
 
peerreynders profile image
peerreynders • Edited

Not sure what you are hoping to find but recently I put together solid-hackernews-a.

Vite uses esbuild for "discarding type annotations" - so npm run dev doesn't type check (presumably that is supposed to happen a priori in the IDE/language server enabled editor). npm run lint:types is used separately for static type checking.

Thread Thread
 
psypher1 profile image
James 'Dante' Midzi

Not looking to find anything specific. I understand technologies better by having a look at how people use them over reading the docs...

I'll have a look, thank you