惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

S
Secure Thoughts
Security Latest
Security Latest
Simon Willison's Weblog
Simon Willison's Weblog
O
OpenAI News
GbyAI
GbyAI
L
LINUX DO - 最新话题
A
Arctic Wolf
T
Tor Project blog
G
GRAHAM CLULEY
I
InfoQ
博客园_首页
IT之家
IT之家
The Register - Security
The Register - Security
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
P
Proofpoint News Feed
The GitHub Blog
The GitHub Blog
Blog — PlanetScale
Blog — PlanetScale
N
Netflix TechBlog - Medium
K
Kaspersky official blog
博客园 - 三生石上(FineUI控件)
S
SegmentFault 最新的问题
U
Unit 42
PCI Perspectives
PCI Perspectives
量子位
P
Palo Alto Networks Blog
S
Securelist
T
Troy Hunt's Blog
博客园 - 【当耐特】
Recorded Future
Recorded Future
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
S
Security Affairs
Engineering at Meta
Engineering at Meta
T
The Blog of Author Tim Ferriss
博客园 - 聂微东
罗磊的独立博客
N
News and Events Feed by Topic
人人都是产品经理
人人都是产品经理
B
Blog RSS Feed
NISL@THU
NISL@THU
C
Cisco Blogs
T
Threatpost
有赞技术团队
有赞技术团队
Forbes - Security
Forbes - Security
Hugging Face - Blog
Hugging Face - Blog
Last Week in AI
Last Week in AI
T
The Exploit Database - CXSecurity.com
Cloudbric
Cloudbric
Cyberwarzone
Cyberwarzone
Google DeepMind News
Google DeepMind News
C
Cyber Attacks, Cyber Crime and Cyber Security

博客园 - bala001

【记录】一文搞懂pinia状态管理(保姆级教程) 前端开发设计模式:原型模式 2025 年前端面试中常见问题 Object.create 前端开发设计模式:工厂模式(Factory Pattern)【下】 前端开发设计模式:工厂模式(Factory Pattern)【上】 前端开发设计模式:单例模式之场景应用&实现 前端开发设计模式:架构 前端开发设计模式: 单例模式(Singleton Pattern) JS篇之JS类型 2024/10/20: TypeScript 学习笔记三:TypeScript 类型系统 博文阅读密码验证 - 博客园 2024/09/20: TypeScript 学习笔记一 css 技巧 博文阅读密码验证 - 博客园 博文阅读密码验证 - 博客园 45 个每个开发人员都应该知道的 JavaScript 超级技巧 - 抄录 明确学习路径与方法 开篇词 - 《重学前端》
2024/09/22:TypeScript 学习笔记二
bala001 · 2024-09-22 · via 博客园 - bala001

1、类型注解

  在 TypeScript 中,可以使用类型注解来明确标识类型。如:

const  greeting: string = 'hello world'

2、类型检查

  • 静态类型检查:在程序编译时进行 —— (两种静态类型检查模式:非严格类型检查【默认方式】;严格类型检查)
  • 动态类型检查:在程序运行时进行

3、TypeScript 中的原始类型:

  • boolean
  • string
  • number
  • null
  • undefined
  • bigint
  • symbol
  • void
  • 枚举类型
  • 字面量类型

4、Nullable 类型
  TypeScript 中的 Nullable 类型指的是值可以为 undefined 或 null 的类型。

5、void 类型:表示某个值不存在,该类型用作函数的返回值类型

  若一个函数没有返回值,那该函数的返回值类型为 void 类型(在其他地方使用 void 类型是无意义的)

6、单元类型:仅包含一个可能值的类型

TypeScript 中的单元类型有以下几种:

  • undefined
  • null
  • unique symbol
  • void
  • 字面量类型
  • 联合枚举成员类型

7、顶端类型

  顶端类型是一种通用类型,有时也称为通用超类型,因为在类型系统中,所有类型都是顶端类型的子类型。

  顶端类型有以下两种:

  • any
  • unknown