It is my understanding that with version 2.1.x of TS that async/await works for ES3/ES5 yet I'm still getting warnings from visual studio 2015 about async functions not being available. Code seems to compile and work but why is visual studio 2015 giving this error message?

package.json

"typescript": "~2.1.6"

tsconfig

{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"noImplicitAny": true,
"suppressImplicitAnyIndexErrors": true,
"allowSyntheticDefaultImports": true,
"sourceMap": true,
"noEmitHelpers": true,
"strictNullChecks": false,
"baseUrl": "./src",
"paths": {
},
"lib": [
  "dom",
  "es6"
],
"types": [
  "node",
  "source-map"
]
},
"exclude": [
"node_modules",
"dist",
"**/*.aot.ts",
"**/*.ngfactory.ts"
],
"awesomeTypescriptLoaderOptions": {
"forkChecker": true,
"useWebpackText": true
},
"compileOnSave": false,
"buildOnSave": false,
"atom": { "rewriteTsconfig": false }
}
1

There are 1 best solutions below

0
On

I had the same problem. It is because the typescript version for your VisualStudio's intelliSense still below 2.1.x . I believe the problem happen because this intelliSense doesn't get the typescript from your package.json (which then will be installed using npm I presume), but it use the VisualStudio's typescript.

So the solution is to update your visualStudio's typescript version. You can update it by install the typescript from the official site of microsoft (currently the latest version is 2.4.1). Restart your visualStudio after installation and hopefully your problem is solved just like mine (The warning from the intelliSense is gone).