gpt4 book ai didi

angular - 错误 TS7008 : Member 'summary' implicitly has an 'any' type

转载 作者:太空狗 更新时间:2023-10-29 16:49:49 25 4
gpt4 key购买 nike

更新到 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com