3 ms·
How would TS fix null in JS without violating its core principles of adhering to EcmaScript standards and being a superset of JS?
by smt88 7mo ago
How would TS fix null in JS without violating its core principles of adhering to EcmaScript standards and being a superset of JS?
- knocte 7mo agoMaybe spit warnings when undefined is used? In the same way it does for when you use typeScript in a type-loose way. But yeah it's a fair point. Sometimes I think I should just write my own lang (a subset of typescript), in the same fashion that Lisette dev has done.
- smt88 7mo agoYou can already do this with strict type checking enabled and the NonNullable type. You can't enforce it in any normal codebase because null is used extensively in the third party libraries you'll have to use for most projects.