简体   繁体   English

元素隐式具有“任何”类型,因为“名称”类型的表达式不能用于索引类型“对象”

[英]Element implicitly has an 'any' type because expression of type '"name"' can't be used to index type 'Object'

Element implicitly has an 'any' type because expression of type '"name"' can't be used to index type 'Object'.元素隐式具有“任何”类型,因为“名称”类型的表达式不能用于索引类型“对象”。 this.resto.getCurrentResto(this.router.snapshot.params['id']).subscribe((result)=> { this.editResto.controls['name'].setValue(result['name']); this.editResto.controls['location'].setValue(result['location']); })

Keyword is implicitly .关键字是隐含的。 Typescript wants you to be explicit about using any . Typescript 希望您明确使用any .

this.resto.getCurrentResto(this.router.snapshot.params['id']).subscribe((result: any)=> { ... }

You will have to do the same for this.editResto.controls if you have not defined a type for it.如果您没有为this.editResto.controls定义类型,则必须对其执行相同的操作。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 元素隐式具有“任何”类型,因为类型“徽标”的表达式不能用于索引 Angular 中的类型“对象” - Element implicitly has an 'any' type because expression of type '"logo"' can't be used to index type 'Object' in Angular 元素隐式具有“任何”类型,因为“数字”类型的表达式不能用于索引“对象”类型 - Element implicitly has an 'any' type because expression of type 'number' can't be used to index type 'Object' '元素隐式具有'any'类型,因为'string'类型的表达式不能用于*ngFor中的Object中的类型索引 - 'Element implicitly has an 'any' type because expression of type 'string' can't be used to index type in Object' in *ngFor 元素隐式具有“任何”类型,因为“字符串”类型的表达式不能用于索引 Angular 中的类型 - Element implicitly has an 'any' type because expression of type 'string' can't be used to index type in Angular TypeScript - 元素隐式具有“任何”类型,因为类型“字符串”的表达式不能用于索引类型“TestObject” - TypeScript - Element implicitly has an 'any' type because expression of type 'string' can't be used to index type 'TestObject ' 元素隐式具有“任何”类型,因为“事件组”类型的表达式不能用于索引类型“MonthViewDay”<eventgroupmeta> '</eventgroupmeta> - Element implicitly has an 'any' type because expression of type '"eventGroups"' can't be used to index type 'MonthViewDay<EventGroupMeta>' Angular - 元素隐式具有“任何”类型,因为“字符串”类型的表达式不能用于索引类型 - Angular - Element implicitly has an 'any' type because expression of type 'string' can't be used to index type 元素隐式具有“任何”类型,因为“_popupComponentRef”类型的表达式不能用于索引类型“MatDatepicker”<Date> &#39; - Element implicitly has an 'any' type because expression of type '"_popupComponentRef"' can't be used to index type 'MatDatepicker<Date>' 元素隐式具有“任何”类型,因为“字符串”类型的表达式不能用于索引类型“搜索查询” - Element implicitly has an 'any' type because expression of type 'string' can't be used to index type 'SearchQuery' 元素隐式具有“任何”类型,因为“字符串”类型的表达式不能用于索引“对象”类型 TS7053 - Element implicitly has an 'any' type because expression of type 'string' can't be used to index type 'Object' TS7053
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM