Re:A 'CSS reset' for TypeScript, improving types for common ...
by moogly on Saturday March 04, 2023 @07:49AM
(#35020419)
As someone who has "strictified" a lot of code bases after the fact, starting out with `strict` is way less friction than adding it later on.
Especially `strictNullChecks`. It's a massive headache to deal with that later on.
Re:A 'CSS reset' for TypeScript, improving types for common ...
by eyelidlessness on Monday March 06, 2023 @03:21PM
(#35047031)
Yup. And strict mode tends to guide devs towards better code/API design. Stuff like function/method overloads with dynamic argument types might seem convenient when the types are loosey goosey, but it usually becomes obvious they’re probably a bad idea when you have to specify the types upfront.
Typescript managed to be the best of both worlds, as you can be both lenient when you're still in the design/prototyping phase of a project, and need to test idea quickly, but also add as much type-check as you see fit when you're maintaining a project, and need to interface with lots of existing code.
As such, I'm always a bit miffed when I see so many people adamant on setting it to maximum strictness by default, under the guise of "best practice".