Skip to content

cyrilletuzi/typescript-strictly-typed

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TypeScript Strictly Typed

Configure TypeScript, ESLint, and optionally Angular to ensure fully typed code. Because strict mode is not enough.

A blog post explains the motivation of this lib.

Tip

I am also the author of the Angular Schematics extension for Visual Studio Code, installed 1 million times. Feel free to give it a try.

Getting started

Just run the following commands in your terminal:

cd path/to/my-project-with-tsconfig
npx typescript-strictly-typed@latest

Important

Going fully typed is a choice to make at the very beginning of a project.

Enabling all strict options at once in an existing project is not recommended, as hundred of errors would appear. Converting an existing project to full strict mode is still possible and encouraged, but it should be done incrementally, by activating each option one by one.

What does it do?

It modifies these configurations:

  • TypeScript compiler options
    • strict (includes: noImplicitAny, strictNullChecks, alwaysStrict, strictBindCallApply, strictFunctionTypes, strictPropertyInitialization, noImplicitThis, useUnknownInCatchVariables)
    • noFallthroughCasesInSwitch
    • noImplicitReturns
    • noPropertyAccessFromIndexSignature
    • noImplicitOverride
    • exactOptionalPropertyTypes
    • noUncheckedIndexedAccess
  • ESLint rules
    • eqeqeq
  • TypeScript ESLint rules
    • @typescript-eslint/no-explicit-any
    • @typescript-eslint/explicit-module-boundary-types
  • Angular compiler options
    • strictInjectionParameters
    • strictTemplates
    • strictInputAccessModifiers
  • Angular ESLint options
    • @angular-eslint/template/no-any

License

MIT