Created October 26, 2021
Updated October 26, 2021

Configure TypeScript to Be Safer

In [TypeScript's Blind Spots], I attempt to catalog the ways that ways you can introduce unsoundness into TypeScript's type system, such as the any type. This post is for cataloging the ways to try to prevent those things and make TypeScript as safe as possible.

Safe JSON#

Ensure Exhaustive Switch Statements#

switch-exhaustiveness-check

Prevent any#

{
    "@typescript-eslint/no-unsafe-argument": error,
    "@typescript-eslint/no-unsafe-assignment": error,
    "@typescript-eslint/no-unsafe-call": error,
    "@typescript-eslint/no-unsafe-member-access": error,
    "@typescript-eslint/no-unsafe-return": error,
}

TODO - what any cases can and cannot be avoided with these rules? Give some examples.

JS Semantics#

strict-boolean-expressions

Sign up to get my latest Elm posts and course notifications in your inbox.

Incremental Elm



Pure Elm content. Unsubscribe any time.