Steps to Convert to TypeScript
What not to do
- functional changes at the same time
- attempt this with low test coverage
- aimming for perfect - don't try to type things too strongly in the beginning
- forget to add tests for your types - dtslint for testing types
- publish types for consumer use when they are in "weak" state
- Compiling in "loose mode"
- start with tests passing
- rename all .js to .ts, allowing implicit any
- fix only the things that are not type-checking, or cauing compile errors
- be careful to avoid changing behavior
- get tests passing again
- Explicit Any
- start with tests passing
- ban implicit any
"noImplicitAny" : true
- where possible, provide a specific and appropriate type
- import types for dependences from DefinitelyTyped
- otherwise explicit any
- get tests passing again
- Squash explicit anys, enable strict mode
- incrementally, in small chunks...
- enable strict mode
"strictNullChecks": true, // the only thing that can hold null is null"strict": true,"strictFunctionTypes": true, // validates arguments and return types of return types"strictBindCallAppy": true // make sure the arguments passed to bind, call, apply and the lexical scope all type check appropriates- replace explicit anys with more appropriated types
- try really hard to avoid unsafe casts