更新到 Angular 2 RC 后,我收到以下错误:
error TS7008: Member 'summary' implicitly has an 'any' type.
在这一行中:
@Input() summary;
怎么了?
编辑:好的,似乎我在我的任何公共(public)变量上都遇到了这个错误。
最佳答案
也许您在 TypeScript 编译器配置中更改了 noImplicitAny
属性的值...请参阅 tsconfig.json 文件:
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": false // <-----
},
"exclude": [
"node_modules",
"typings/main",
"typings/main.d.ts"
]
}
您可以尝试在您的属性上添加一个类型。像这样的东西:
@Input() summary:string;
关于angular - 错误 TS7008 : Member 'summary' implicitly has an 'any' type,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37032857/