Skip to content

Instantly share code, notes, and snippets.

@alexilyaev
Last active December 7, 2022 20:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexilyaev/f97f0821a4aa8d4181fb7cf5f8339d08 to your computer and use it in GitHub Desktop.
Save alexilyaev/f97f0821a4aa8d4181fb7cf5f8339d08 to your computer and use it in GitHub Desktop.
TypeScript Guideliens

Style Guides

Guidelines

  • 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