Replies: 2 comments
-
|
Beta Was this translation helpful? Give feedback.
0 replies
-
每个类型作用如下:
let name: any = 'leo';
name = 999;
name = true;
// ... 详细介绍可以看文档:any
// 返回never的函数必须存在无法达到的终点
function error(message: string): never {
throw new Error(message);
}
详细介绍可以看文档:never
let name: unknown = 'leo';
name = 999;
name.toString(); // Object is of type 'unknown'.(2571) 详细介绍可以看文档:unknown
详细介绍可以看文档:null and undefined
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
TypeScript 中 any、never、unknown、null & undefined 和 void 有什么区别?
Beta Was this translation helpful? Give feedback.
All reactions