[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
}

posted @   Zhentiw  阅读(20)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· AI技术革命,工作效率10个最佳AI工具
历史上的今天:
2021-07-19 [SAA + SAP] 05. Route 53
2019-07-19 [RxJava] Composition, Run in parallel with Schedulers.io()
2018-07-19 [Vue-rx] Cache Remote Data Requests with RxJS and Vue.js
2016-07-19 [Javascript] Use Number() to convert to Number if possilbe
2016-07-19 [Ember] Creating Your First Ember.js Project with Ember-CLI
点击右上角即可分享
微信分享提示