Skip to content

Commit

Permalink
Clarify documentation around optional and strictNullChecks
Browse files Browse the repository at this point in the history
  • Loading branch information
thesunny committed Jun 4, 2022
1 parent 8cedb38 commit a6cf32a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion docs/guides/06-using-typescript.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Superstruct is built with TypeScript, and is designed to integrate seamlessly with its guards and assertions. Which means that if you're using TypeScript too you'll get compile-time typings for your data.

> 🤖 Warning: If you are not using TypeScript's [`strictNullChecks`](https://www.typescriptlang.org/tsconfig#strictNullChecks) option, Superstruct will be unable to infer your "optional" types correctly and will mark all types as optional.
> 🤖 Warning: You must enable TypeScript's [`strictNullChecks`](https://www.typescriptlang.org/tsconfig#strictNullChecks) option in your `tsconfig.json` for Superstruct to work properly with "optional" types. Note that `strictNullChecks` is disabled by default. If you enable `strict`, `strictNullChecks` will automatically be enabled.
## Narrowing Types

Expand Down
2 changes: 2 additions & 0 deletions docs/reference/types.md
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,8 @@ undefined

`optional` structs validate that a value matches a specific struct, or that it is `undefined`.

> 🤖 Warning: If you are using TypeScript, you must enable TypeScript's [`strictNullChecks`](https://www.typescriptlang.org/tsconfig#strictNullChecks) option in your `tsconfig.json` for Superstruct to work properly with "optional" types. Note that `strictNullChecks` is disabled by default. If you enable `strict`, `strictNullChecks` will automatically be enabled.
### `record`

```ts
Expand Down

0 comments on commit a6cf32a

Please sign in to comment.