I am trying to use async/await functions with angular2-webpack-starer and typescript (which now have support for this functions targeting es5), but I'm getting error:
This is code inside component:
// function inside component
async checkSlug(slug: string) {
// nothing here
}
I am using webpack2.2 and typescript 2.1.5. This is my tsconfig:
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"allowSyntheticDefaultImports": true,
"sourceMap": true,
"noEmit": true,
"noEmitHelpers": true,
"strictNullChecks": false,
"baseUrl": "./src",
"paths": {
},
"lib": [
"dom",
"es7",
"es2015.promise"
],
"types": [
"hammerjs",
"jasmine",
"node",
"protractor",
"selenium-webdriver",
"source-map",
"uglify-js",
"webpack",
"chai",
"chai-as-promised",
"lodash"
]
},
"exclude": [
"node_modules",
"dist"
],
"awesomeTypescriptLoaderOptions": {
"forkChecker": true,
"useWebpackText": true
},
"compileOnSave": false,
"buildOnSave": false,
"atom": { "rewriteTsconfig": false }
}
Ok, this tsconfig.json works
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"allowSyntheticDefaultImports": true,
"sourceMap": true,
"noEmit": true,
"noEmitHelpers": false,
"strictNullChecks": false,
"baseUrl": "./src",
"paths": {
},
"lib": [
"dom",
"es7",
"es5",
"es2015.promise"
],
"types": [
"hammerjs",
"jasmine",
"node",
"protractor",
"selenium-webdriver",
"source-map",
"uglify-js",
"webpack",
"chai",
"chai-as-promised",
"lodash"
]
},
"exclude": [
"node_modules",
"dist"
],
"awesomeTypescriptLoaderOptions": {
"forkChecker": true,
"useWebpackText": true
},
"compileOnSave": false,
"buildOnSave": false,
"atom": { "rewriteTsconfig": false }
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With