8 ms·
I did this on my current project. Basically: - Set up your TypeScript config - Set up Typings (or some other type def manager) - Rename all ".js" files to ".
by jestar_jokin 10y ago
I did this on my current project. Basically:
- Set up your TypeScript config
- Set up Typings (or some other type def manager)
- Rename all ".js" files to ".ts"
- Replace all "var x = require()" calls to "import x = require()"
- Gradually refactor components (controllers, directives, services) to classes, or at least add type annotations to everything.
Because TypeScript is a superset of JavaScript, you can work on an untyped system and add gradual typing until the codebase starts looking nicer. Any new functionality can be implemented in TypeScript; any existing functionality can be slowly refactored when it is touched by changes.
- whatever_dude 10y agoI'd add tslint to that once the basic migration is done. It can get a lot of issues in the code that are either bad stylistic options, or things that can produce errors in the future.