Skip to content

Commit

Permalink
Improve description of the 'message' parameter passed to 'invariant'
Browse files Browse the repository at this point in the history
  • Loading branch information
kyarik committed Aug 31, 2020
1 parent e00b4ad commit 223ff68
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ invariant(value: unknown, message?: string): asserts value

- `value: unknown` is the value that we want to ensure to be [truthy](https://developer.mozilla.org/en-US/docs/Glossary/truthy).

- `message?: string` is an optional error message that will be part of the error that is thrown in case `value` is [falsy](https://developer.mozilla.org/en-US/docs/Glossary/Falsy). This message is only displayed in development. In production, only a generic error is shown instead (`'Invariant violation'`) and the `message` parameter is ignored.
- `message?: string` is an optional error message that will be included in the error that is thrown when the passed `value` is [falsy](https://developer.mozilla.org/en-US/docs/Glossary/Falsy). This custom error message is displayed only in development. In production, a generic error is shown instead (`'Invariant violation'`) and the `message` parameter is ignored.

#### Return value

Expand Down

0 comments on commit 223ff68

Please sign in to comment.