Search code examples
javascripttypescriptvisual-studio-2017screeps

Typescript generates typescript instead of javascript


So I wanted to start rewriting my code from Screeps using Typescript. But for some reason instead of generating a Javascript code, it generates the same typescript code. Am I missing something from tsconfig.json file?

Left Typescript, right suppose to be Javascript

enter image description here

tsconfig.json File

{
  "compileOnSave": true,
  "compilerOptions": {
    "module": "es2015",
    "lib": [ "esnext" ],
    "target": "es2015",
    "moduleResolution": "Node",
    "outDir": "../",
    "baseUrl": "src/",
    "sourceMap": true,
    "strict": true,
    "experimentalDecorators": true,
    "noImplicitReturns": true,
    "allowSyntheticDefaultImports": true,
    "allowUnreachableCode": false,
    "noImplicitAny": false,
    "noEmitOnError": true,
    "removeComments": false
  },
  "exclude": [
    "node_modules"
  ]
}

Maybe I am missing from this file, I am new to typescript. Using Visual Studio 2017 Community.


Solution

  • The output is JavaScript, compliant with ES6 (also known as ES2015). export, const, class, etc are all legal JavaScript.

    If you want to generate code to run on old browsers, change target to es5 or es3