Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 5459b3c

Browse files
committedAug 21, 2023
docs(types): fixed #64
1 parent abcc074 commit 5459b3c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed
 

‎docs/types.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,11 @@ const x:null = null;
129129

130130
上面示例中,变量`x`就属于 null 类型。
131131

132-
注意,如果没有声明类型的变量,被赋值为`undefined``null`,它们的类型会被推断为`any`
132+
注意,如果没有声明类型的变量,被赋值为`undefined``null`在关闭编译设置`noImplicitAny``strictNullChecks`时,它们的类型会被推断为`any`
133133

134134
```typescript
135+
// 关闭 noImplicitAny 和 strictNullChecks
136+
135137
let a = undefined; // any
136138
const b = undefined; // any
137139

@@ -143,6 +145,7 @@ const d = null; // any
143145

144146
```typescript
145147
// 打开编译设置 strictNullChecks
148+
146149
let a = undefined; // undefined
147150
const b = undefined; // undefined
148151

0 commit comments

Comments
 (0)
Please sign in to comment.