Error: Cannot invoke an expression whose type lacks a call signature

后端 未结 8 2100
执笔经年
执笔经年 2020-12-02 17:50

I am brand new to typescript, and I have two classes. In the parent class I have:

abstract class Component {
  public deps: any = {};
  public props: any = {         


        
8条回答
  •  猫巷女王i
    2020-12-02 18:36

    Add a type to your variable and then return.

    Eg:

    const myVariable : string [] = ['hello', 'there'];
    
    const result = myVaraible.map(x=> {
      return
      {
        x.id
      }
    });
    

    => Important part is adding the string[] type etc:

提交回复
热议问题