其他分享
首页 > 其他分享> > [Typescript] Unknow and any Types

[Typescript] Unknow and any Types

作者:互联网

`any` type, you can assign any value for any type.

 

For `unkown`, you can also assign any value to unkwon:

 

But you cannot assign unkwon variable to another variable without checking the type, unknow force you to do the type checking before assign.

if (typeof value14 === "string") {
  type value14: string = unknowValue // works
}

标签:value14,string,Unknow,assign,Typescript,type,any,unkwon
来源: https://www.cnblogs.com/Answer1215/p/16492603.html