---
title: "Discussion on \"<Programming with Types>随想: Chapter 2. Basic types\" | Hashnode"
description: "Discussion on \"<Programming with Types>随想: Chapter 2. Basic types\". 类型限制了一个变量可以接受的有效值的集合，对数据可以进行的操作，数据的意义。\n\n空类型(The empty type)\n根据类型的定义，类型定义了可以接受的有效值集合，那么这个集合有没有可能为空？答案是有可能的，TypeScirpt 的 never 就是这种类型。\n需要注意的是，空类型不同与 void, 后者是有效值集合当中只有一个值，但这个值没有任何意义。而空类型的有效值集合本身是空的。\n使用场景\n控制流分析\n在函数调用时，标志一个函数不会返回任何值: 在调用过程中抛出异常、死循环或者程序崩溃..."
url: "https://hashnode.com/posts/programming-with-types-chapter-2-basic-types/640411baba8baa592246d2d2"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [<Programming with Types>随想: Chapter 2. Basic types](https://qilingzhao.com/programming-with-types-chapter-2-basic-types?utm_source=hashnode&utm_medium=feed)

类型限制了一个变量可以接受的有效值的集合，对数据可以进行的操作，数据的意义。 空类型(The empty type) 根据类型的定义，类型定义了可以接受的有效值集合，那么这个集合有没有可能为空？答案是有可能的，TypeScirpt 的 never 就是这种类型。 需要注意的是，空类型不同与 void, 后者是有效值集合当中只有一个值，但这个值没有任何意义。而空类型的有效值集合本身是空的。 使用场景 控制流分析 在函数调用时，标志一个函数不会返回任何值: 在调用过程中抛出异常、死循环或者程序崩溃...

Mar 5, 2023 · 2 min read · qilingzhao.com  
Read the article

-   [#typescript](https://hashnode.com/tag/typescript)
-   [#programming-with-types](https://hashnode.com/tag/programming-with-types)

## Written by

[qilingzhao](https://hashnode.com/@Zhao70)

@Zhao70

  
[View profile](https://hashnode.com/@Zhao70)

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
