The condition that, if falsy, will throw the error during development
Optionalmessage: string | (() => string)
A string or a function that returns a string, "Invariant failed" by default
Optionallib: string
The library name to show in the error message prefix. When prefix is also specified it outputs [lib:prefix]: the message, otherwise just [lib]: the message
Optionalprefix: string
The prefix (e.g. the function name) to show in the error message prefix. When lib is also specified it outputs [lib:prefix]: the message, otherwise just [prefix]: the message
FIXME: invariant calls do not get tree shaked in minified output of projects using it. Let's not use it internally and not export it from
@knitkode/utilsuntil we find a tree-shakeable way of doing this. For now just wrapping the logging code intoif (process.env["NODE_ENV"] === "development") {}works better despite it is more verbose.