This is a guideline on how to write effective TypeScript with the least effort. It touch on coding style, linting, to recommendation on writing good typings and writing TypeScript code.
Since the beginning of this project, the TypeScript team has added a lot of information its documentation. So make sure you have time to check it out.
For writing typings, also check out https://github.com/types/guidelines
- Get the best out of TypeScript
- Stay close to JavaScript as much as possible
- Embrace latest JavaScript syntax
- Cross-compatibility with tools. In my company, we embrace diversity and support team member to use their favorite IDEs. However it is really frustrating when the tools do not get along with each other!
- IDE / Editors
- Linter
Recently I do most of my work in VS Code. So if you find that some of the guidelines doesn't work well in your IDE, let me know and we can see how to get it working on your IDE.
- Introduction
- Files and Projects
- Language
- Coding Practice
- Types
- Typings
- Advance types
- Tooling
- draft File structures
- draft Types
- draft Objects
- draft Destructuring
- draft Strings
- draft Functions
- draft Control statements
- draft Modules
- draft Iterators and Generators
- draft Properties
- draft Variables
- draft Hoisting
- draft Comparison Operators & Equality
- draft Blocks
- draft Comments
- draft Whitespaces
- draft Commas
- draft Semicolons
- draft Type Casting & Coercion
- draft Naming Conventions
- draft Events
- draft ECMAScript 6 Styles
-
Follow the
markdown style guide
-
Each section heading should be neutral, e.g. "
var
keyword" instead of "avoidvar
"Why? The heading would be used as link. So if the style guide suggestion changes, keeping the heading neutral would avoid broken links.