Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting error-highlighting on things like `Object.assign` and `Promise<any>`

Hi I'm having problems supporting the "lib" property in tsconfig when using WebStorm 2016.2.2.

I've tried editing the TypeScript version in the IDE preferences (Preferences -> Languages & Frameworks -> TypeScript) and pointing to a globally-installed TypeScript 2.0 version, but I'm still getting error-highlighting on things like Object.assign and Promise<any>.

I've restarted the IDE multiple times, and nothing seems to change, any ideas on how to fix or debug this?

//tsconfig.json
{
  "compilerOptions": {
    "target": "es5",
    "module": "commonjs",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "sourceMap": true,
    "noEmitHelpers": true,
    "strictNullChecks": false,
    "baseUrl": "./src",
    "paths": {
        "core": ["app/core"],
        "reactive": ["app/reactive"],
        "models": ["app/models"],
        "services": ["app/services"]
    },
    "lib": [
      "dom",
      "es6"
    ],
    "types": [
      "hammerjs",
      "jasmine",
      "node",
      "protractor",
      "selenium-webdriver",
      "source-map",
      "uglify-js",
      "webpack"
    ]
  },
  "exclude": [
    "node_modules",
    "dist"
  ],
  "awesomeTypescriptLoaderOptions": {
    "forkChecker": true,
    "useWebpackText": true
  },
  "compileOnSave": false,
  "buildOnSave": false,
  "atom": { "rewriteTsconfig": false }
}
like image 826
exk0730 Avatar asked Sep 07 '16 14:09

exk0730


1 Answers

You specified:

"target": "es5"

So the compiler will compile it with the regular lib.d.ts and not the lib.es6.d.ts and so ES6 features such as Object.assign and Promise and others are missing.

Change it to

"target": "es6"

and it should be fine.

like image 63
Nitzan Tomer Avatar answered Nov 18 '22 19:11

Nitzan Tomer