Dar*_*iak 5 async-await typescript webpack-2 typescript2.0 angular
我想使用异步/ AWAIT功能与angular2-的WebPack-starer和打字稿(现在有这个功能针对ES5的支持),但我发现了错误:

这是组件内部的代码:
// function inside component
async checkSlug(slug: string) {
// nothing here
}
Run Code Online (Sandbox Code Playgroud)
我正在使用 webpack2.2 和 typescript 2.1.5。这是我的 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 }
}
Run Code Online (Sandbox Code Playgroud)
好的,这个 tsconfig.json 可以工作
{
"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 }
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2045 次 |
| 最近记录: |