`any` type, you can assign any value for any type.
![[Typescript] Unknow and any Types](https://blog.ytso.com/wp-content/themes/justnews/themer/assets/images/lazy.png)
For `unkown`, you can also assign any value to unkwon:
![[Typescript] Unknow and any Types](https://blog.ytso.com/wp-content/themes/justnews/themer/assets/images/lazy.png)
But you cannot assign unkwon variable to another variable without checking the type, unknow force you to do the type checking before assign.
![[Typescript] Unknow and any Types](https://blog.ytso.com/wp-content/themes/justnews/themer/assets/images/lazy.png)
if (typeof value14 === "string") {
type value14: string = unknowValue // works
}
原创文章,作者:6024010,如若转载,请注明出处:https://blog.ytso.com/tech/pnotes/275329.html