object Object {} any unknown

object: 除了primitive(boolean null number string undefined bigint symbol)的类型

Object:

Object和any很像 ,Object有更严格的约束

Object表示装箱后的原始类型对象,即有方法的原始类型(describes funtionality that is common to all JS objects)

和any的区别是:

let a:any

let b:Object

扫描二维码关注公众号,回复: 6966195 查看本文章

a.nomethod() // okay

b.nomethods() // error

{}:

{}和Object一样,根据查询的资料,{}继承了Object但是没有添加任何东西

unkown:

unknown type is only assignable to the any type and the unknown type itself

https://mariusschulz.com/blog/the-unknown-type-in-typescript

猜你喜欢

转载自www.cnblogs.com/eret9616/p/11311524.html