Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.

Commit fdd6ba4

Browse files
authored
Add undefined / void exception
1 parent 98618ca commit fdd6ba4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pages/Basic Types.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ let n: null = null;
204204
By default `null` and `undefined` are subtypes of all other types.
205205
That means you can assign `null` and `undefined` to something like `number`.
206206

207-
However, when using the `--strictNullChecks` flag, `null` and `undefined` are only assignable to `any` and their respective types.
207+
However, when using the `--strictNullChecks` flag, `null` and `undefined` are only assignable to `any` and their respective types (the one exception being that `undefined` is also assignable to `void`).
208208
This helps avoid *many* common errors.
209209
In cases where you want to pass in either a `string` or `null` or `undefined`, you can use the union type `string | null | undefined`.
210210
Once again, more on union types later on.

0 commit comments

Comments
 (0)