Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3be9f5a

Browse files
authored
Update type-of-function.md and primitive-data-types.md (xcatliu#205)
* Update type-of-function.md fix: Function lacks ending return statement and return type does not include 'undefined'. * Update primitive-data-types.md BigInt是ES10中新增 * Update type-of-function.md fix: Function lacks ending return statement and return type does not include 'undefined'.
1 parent 8f21e30 commit 3be9f5a

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

basics/primitive-data-types.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
JavaScript 的类型分为两种:原始数据类型([Primitive data types][])和对象类型(Object types)。
44

5-
原始数据类型包括:布尔值、数值、字符串、`null``undefined` 以及 ES6 中的新类型 [`Symbol`][][`BigInt`][]
5+
原始数据类型包括:布尔值、数值、字符串、`null``undefined` 以及 ES6 中的新类型 [`Symbol`][]ES10 中的新类型 [`BigInt`][]
66

77
本节主要介绍**前五种**原始数据类型在 TypeScript 中的应用。
88

basics/type-of-function.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ push(a, 1, 2, 3);
184184
利用联合类型,我们可以这么实现:
185185

186186
```ts
187-
function reverse(x: number | string): number | string {
187+
function reverse(x: number | string): number | string | void {
188188
if (typeof x === 'number') {
189189
return Number(x.toString().split('').reverse().join(''));
190190
} else if (typeof x === 'string') {
@@ -200,7 +200,7 @@ function reverse(x: number | string): number | string {
200200
```ts
201201
function reverse(x: number): number;
202202
function reverse(x: string): string;
203-
function reverse(x: number | string): number | string {
203+
function reverse(x: number | string): number | string | void {
204204
if (typeof x === 'number') {
205205
return Number(x.toString().split('').reverse().join(''));
206206
} else if (typeof x === 'string') {

0 commit comments

Comments
 (0)