Argument of type 'X' is not assignable to parameter of type 'X'

前端 未结 9 1940
名媛妹妹
名媛妹妹 2021-02-02 05:15

Good day. I\'m new to Type Script, using VSCode.

Getting following errors:

  1. error TS2322: Type \'() => string\' is not assignable to type

9条回答
  •  难免孤独
    2021-02-02 05:34

    This problem basically comes when your compiler gets failed to understand the difference between cast operator of the type string to Number.

    you can use the Number object and pass your value to get the appropriate results for it by using Number(<<<<...Variable_Name......>>>>)

提交回复
热议问题