Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
TypeScript Guideliens

Style Guides


  • Avoid using any as much as possible.
    • If you want a type meaning "any object", use Record<string, unknown> instead.
    • If you want a type meaning "any value", you probably want unknown instead.
    • See typescript-eslint - ban-types.
  • Prefer using interface over type when possible.
  • Avoid needlessly typing the return value of a function if the compiler can infer it.
  • Annotate arrays as foos: Foo[] instead of foos: Array<Foo>.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment