“any” in Typescript

后端 未结 4 1596
不知归路
不知归路 2021-01-20 15:10

I am beginner in typescript. I have a doubt in usage of \"any\" type.

Using \"any\" is basically opting out type checking if I am right. For example

4条回答
  •  萌比男神i
    2021-01-20 15:54

    While the two are equivalent in use (because any is the default type when unspecified) by explicitly specifying the type as any, you explicitly declare the intent.

    Intellisense, where available, will display the type as any, allowing easier understanding how your variable is meant to be used.

提交回复
热议问题