当我在浏览器(ionic serve -l(中运行我的应用程序时,一切都很好,即使在大多数Android设备上也没有问题,但我发现一些不会启动应用程序并在设备上出错时死亡。我在安卓 5.0.2 上运行时遇到问题。我什至尝试在tsconfig.json中关闭严格模式,但没有成功。是否有人遇到过类似的问题,或者有什么方法可以找出问题的确切位置?
tsconfig.json
{
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"declaration": false,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"diagnostics": true,
"allowUnreachableCode": true,
"noImplicitUseStrict": true,
"lib": [
"dom",
"es2015"
],
"module": "es2015",
"moduleResolution": "node",
"sourceMap": true,
"target": "es5"
},
"include": [
"src/**/*.ts"
],
"exclude": [
"node_modules"
],
"compileOnSave": false,
"atom": {
"rewriteTsconfig": false
}
}
您可以使用以下所有选项来配置严格的类型检查:
/* Strict Type-Checking Options */
"strict": true, /* Enable all strict type-checking options. */
"noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
"strictNullChecks": true, /* Enable strict null checks. */
"noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
"alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
请注意,TypeScript 2.3 中添加了"严格"配置