Gradual Migration from JavaScript to TypeScript


You have an existing project in which you’d like to use TypeScript.


Simply remove the outDir from tsconfig.json, e.g.:

  "compilerOptions": {
         "allowJs": false,
    "outDir": "./tsDist/",
    "module": "es6",
    "target": "es6",
    "experimentalDecorators": true,
    "moduleResolution": "node"
  "exclude": [

Everything should work now (since ts file will be compiled to a JS file at the same location; so all the imports etc will work just fine).

Sometimes things get out of sync between ts and js files (might have something to do with IntelliJ); in that case I just manually execute tsc command.

Alternative approach didn’t work well for me; e.g. due to the 100+ errors that would need to be resolved (when I simply renamed the js -> ts files).

keywords: mixing ts js typescript javascript in the same project incremental


About Neil Rubens

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *