Element implicitly has an 'any' type because expression of type 'string' can't be used to index

后端 未结 9 1558
滥情空心
滥情空心 2020-11-27 15:42

Trying out TypeScript for a React project and I\'m stuck on this error:

Element implicitly has an \'any\' type because expression of type \'string\' can\'t b         


        
9条回答
  •  情书的邮戳
    2020-11-27 16:42

    I use this:

    interface IObjectKeys {
      [key: string]: string | number;
    }
    
    interface IDevice extends IObjectKeys {
      id: number;
      room_id: number;
      name: string;
      type: string;
      description: string;
    }
    

提交回复
热议问题