【发布时间】:2018-04-13 23:05:33
【问题描述】:
尽管我的tsconfig.json 中有strict: true,但这不会出错:
const a: (b?: string) => string[] =
(c : string) => c.split(',');
^
should scream in vein
如何让 TypeScript 对此感到恐慌?
软件包版本:
- 打字稿 2.5.3
- ts-loader 3.1.1
- webpack 3.6.0
这是我完整的tsconfig.json:
{
"compilerOptions": {
"target": "es2015",
"module": "commonjs",
"strict": true,
"noImplicitAny": true,
"allowJs": true,
"sourceMap": true,
"allowSyntheticDefaultImports": false,
"moduleResolution": "node",
"noUnusedLocals": true,
"noUnusedParameters": false,
"preserveConstEnums": false,
"removeComments": false,
"lib": [
"es5",
"es6",
"dom",
"es2015.core",
"es2015.collection",
"es2015.generator",
"es2015.iterable",
"es2015.promise",
"es2015.proxy",
"es2015.reflect",
"es2015.symbol",
"es2015.symbol.wellknown",
"esnext.asynciterable"
]
},
"exclude": [
"node_modules",
"test",
".git"
]
}
【问题讨论】:
标签: typescript types typescript2.0