Skip to content

Releases: alexreardon/tiny-invariant

1.3.3

23 Feb 21:40
Compare
Choose a tag to compare
  • Updating dev dependency resolution URLs in yarn.lock file to point to a common npm registry

1.3.2

23 Feb 00:30
Compare
Choose a tag to compare
  • added jsdoc to function signature for improved IDE usage #177 (thanks @DarkPurple141 for originally raising and pushing for this)
  • upgraded all dev dependencies to latest #178

1.3.1

28 Sep 10:44
Compare
Choose a tag to compare
  • Fix(types): Fixed an issue with TypeScript not being able to locate .d.ts with moduleResolution: node16 by @Andarist and @pkerschbaum #20. Thank you so much!
  • Chore(build): Removing a custom build script in favour of generating a file in the rollup build #149. Thanks @Andarist!

1.3.0

28 Sep 02:55
Compare
Choose a tag to compare

Improved support for Node.js + ESM

Thanks to a heroic effort by @pkerschbaum tiny-invariant now supports EcmaScript Modules (ESM) usage in Node.js #145. Thanks so much @pkerschbaum 👏

This resulted in a minor release as it a backwards compatible change that adds new functionality

Other

  • Bumping all dev dependencies to latest #131 #148

1.2.0

31 Oct 22:06
Compare
Choose a tag to compare

New: Get message function

The message provided to invariant can now be a function that returns a string

- export default function invariant(condition: any, message?: string): asserts condition;
+ export default function invariant(condition: any, message?: string | (() => string)): asserts condition;

Using a function that returns a string is helpful in cases where your message is expensive to create. By using a function you only need to create the message when you need it.

import invariant from 'tiny-invariant';

invariant(value, () => getExpensiveMessage());

Keep in mind, that ideally the second argument to invariant is stripped away entirely in production builds.

We have a guide on how to do remove messages for production builds

1.1.0

30 Jan 03:45
Compare
Choose a tag to compare
  • Now TypeScript native! (flow usage still supported ❤️)
  • Leverages the new [email protected] asserts keyword to correctly narrow types (caused a feature release)
const user: Person | null = getPerson();
invariant(user, 'expected user to be populated');
    
// the type of `user` is now narrowed to 'Person' rather than `Person | null`

1.0.6

15 Jul 00:17
Compare
Choose a tag to compare

Fixing typescript definition. #43 Thanks @ngryman and @TrySound!

1.0.5

09 Jul 01:23
Compare
Choose a tag to compare

1.0.4

27 Mar 00:30
Compare
Choose a tag to compare
  • Moving to flow 0.95.1
  • Bumping dev deps
  • Adding missing MIT license file #27. MIT was previously specified in the package.json but the LICENSE file was missing.

1.0.3

07 Nov 02:05
Compare
Choose a tag to compare
  • moving to flow 0.85
  • bumping dev deps