← Back to context

Comment by smt88

9 hours ago

How would TS fix null in JS without violating its core principles of adhering to EcmaScript standards and being a superset of JS?

Maybe 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.

  • You 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.