diff --git a/src/tiny-invariant.flow.js b/src/tiny-invariant.flow.js deleted file mode 100644 index 0f534cc..0000000 --- a/src/tiny-invariant.flow.js +++ /dev/null @@ -1,12 +0,0 @@ -// @flow -// This file is not actually executed -// It is just used by flow for typing - -const prefix: string = 'Invariant failed'; - -export default function invariant(condition: mixed, message?: string | (() => string)) { - if (condition) { - return; - } - throw new Error(`${prefix}: ${message || ''}`); -} diff --git a/src/tiny-invariant.js.flow b/src/tiny-invariant.js.flow new file mode 100644 index 0000000..fc577df --- /dev/null +++ b/src/tiny-invariant.js.flow @@ -0,0 +1,8 @@ +// @flow + +declare module "tiny-invariant" { + declare export default function invariant( + condition: mixed, + message?: string | (() => string), + ): boolean; +}