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

Emphasize that void accepts null unless strictNullChecks #1096

Merged
merged 1 commit into from
Aug 20, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion pages/Basic Types.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,11 @@ function warnUser(): void {
}
```

Declaring variables of type `void` is not useful because you can only assign `undefined` or `null` to them:
Declaring variables of type `void` is not useful because you can only assign `null` (only if `--strictNullChecks` is not specified, see next section) or `undefined` to them:

```ts
let unusable: void = undefined;
unusable = null; // OK if `--strictNullChecks` is not given
```

# Null and Undefined
Expand Down