错误TS7008:成员“摘要"隐式具有“任何"类型 [英] error TS7008: Member 'summary' implicitly has an 'any' type
本文介绍了错误TS7008:成员“摘要"隐式具有“任何"类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
更新到Angular 2 RC后,出现以下错误:
After Updating to Angular 2 RC I got the following error:
error TS7008: Member 'summary' implicitly has an 'any' type.
在此行:
@Input() summary;
怎么了?
好吧,好像我在任何公共变量上都遇到了此错误.
Ok, seem like I get this error on ANY of my public variables.
推荐答案
也许您在TypeScript编译器配置中更改了noImplicitAny
属性的值...请参阅tsconfig.json文件:
Perhaps you changed the value of the noImplicitAny
attribute in your TypeScript compiler configuration... See the tsconfig.json file:
{
"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"
]
}
您可以尝试在媒体资源上添加类型.像这样:
You could try to add a type on your property. Something like:
@Input() summary:string;
这篇关于错误TS7008:成员“摘要"隐式具有“任何"类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文