TypeScript's Deliberate Unsoundness: Seven Programs That Pass --strict Yet Crash

The article argues that TypeScript was intentionally designed without a sound type system, prioritizing productivity over provable correctness, as stated in its design goals and handbook. It presents seven programs that compile cleanly under the --strict flag but throw TypeErrors at runtime. The author explains that the flag omits checks such as noUncheckedIndexedAccess and exactOptionalPropertyTypes, which must be enabled separately. Covariant array assignment and method bivariance in function parameter checks are examined as key sources of these gaps. Each example is linked to official TypeScript documentation so readers can verify the behavior themselves.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in