diff --git a/basics/primitive-data-types.md b/basics/primitive-data-types.md index 838a8463..eaa98635 100644 --- a/basics/primitive-data-types.md +++ b/basics/primitive-data-types.md @@ -2,7 +2,7 @@ JavaScript 的类型分为两种:原始数据类型([Primitive data types][])和对象类型(Object types)。 -原始数据类型包括:布尔值、数值、字符串、`null`、`undefined` 以及 ES6 中的新类型 [`Symbol`][] 和 [`BigInt`][]。 +原始数据类型包括:布尔值、数值、字符串、`null`、`undefined` 以及 ES6 中的新类型 [`Symbol`][] 和 ES10 中的新类型 [`BigInt`][]。 本节主要介绍**前五种**原始数据类型在 TypeScript 中的应用。 diff --git a/basics/type-of-function.md b/basics/type-of-function.md index dc965ef0..e1a77b91 100644 --- a/basics/type-of-function.md +++ b/basics/type-of-function.md @@ -184,7 +184,7 @@ push(a, 1, 2, 3); 利用联合类型,我们可以这么实现: ```ts -function reverse(x: number | string): number | string { +function reverse(x: number | string): number | string | void { if (typeof x === 'number') { return Number(x.toString().split('').reverse().join('')); } else if (typeof x === 'string') { @@ -200,7 +200,7 @@ function reverse(x: number | string): number | string { ```ts function reverse(x: number): number; function reverse(x: string): string; -function reverse(x: number | string): number | string { +function reverse(x: number | string): number | string | void { if (typeof x === 'number') { return Number(x.toString().split('').reverse().join('')); } else if (typeof x === 'string') {