News for hackers. Stuff that matters.
Re:A 'CSS reset' for TypeScript, improving types for common ... by capableweb on Friday March 03, 2023 @06:32AM (#35008223)
> Any is okay for 200 LOC quick prototypes

If you're writing a prototype (so the code will eventually be thrown away), it's just 200 LOC and you're using `any` for everything, why even use TypeScript? Should just use vanilla JavaScript instead.

And if you wanna break the rule of throwing away prototype code, you can always "upgrade" it to TypeScript later without too much fuzz.

Re:A 'CSS reset' for TypeScript, improving types for common ... by solarkraft on Friday March 03, 2023 @07:37AM (#35008732)
Standard tooling. It's also still useful even if you just consume the types.
Re:A 'CSS reset' for TypeScript, improving types for common ... by Klathmon on Friday March 03, 2023 @07:38AM (#35008750)
Who said using any for everything?

I love using TS for prototypes because you can define the interfaces wherever you feel they're important, and leave the rest to any.

And like you said, you can always improve the types later

Re:A 'CSS reset' for TypeScript, improving types for common ... by nicoburns on Friday March 03, 2023 @07:48AM (#35008854)
> If you're writing a prototype (so the code will eventually be thrown away), it's just 200 LOC and you're using `any` for everything, why even use TypeScript? Should just use vanilla JavaScript instead.

The case where I've found this useful is making a quick and dirty prototype that integrates within an existing typescript codebase. Such a prototype would never make it to the main branch but sometimes it's useful to make a quick proof of concept of the the runtime behaviour before comitting to sorting out the types.