tiny-invariant provides a tiny, zero-dependency invariant function that throws when a provided condition is falsy, useful for runtime assertions. It supports optional string messages (or message factory functions) and can help with type narrowing in Flow and TypeScript, while dropping message details in production (generic “Invariant failed”).
Project status
- The repository appears mostly in maintenance mode, with the last noted published updates in Feb 2024 (v1.3.3 and v1.3.2) and no recent major functionality changes indicated in the update notes; the latest upstream push recorded is 2024-07-25.
- Update cadence looks infrequent, with a long gap from v1.3.1 (2022-09-28) to v1.3.2 (2024-02-23), followed by a quick maintenance follow-up to v1.3.3 (also 2024-02-23).
AI summary generated Today
Recent updates
v1.3.3
2/23/2024Release 1.3.3 is a maintenance version bump for tiny-invariant. The stated change is confined to updating dev dependency resolution URLs in yarn.lock to use a common npm registry.
v1.3.2
2/23/2024Release 1.3.2 primarily updates the `invariant` function documentation (JSDoc) to improve IDE/help output, and upgrades the project toolchain by bumping dev dependencies. The runtime API surface in `src/tiny-invariant.ts` appears unchanged, but the build and TypeScript declaration generation pipeline has shifted due to major dev dependency upgrades.
Featuresv1.3.1
9/28/2022v1.3.1 focuses on TypeScript declaration resolution and a build pipeline tweak for the ESM output. It adjusts package exports to help TypeScript find the generated .d.ts files when using node16-style module resolution, and it changes how the ESM package.json file with type=module is produced during the build.
v1.3.0
9/28/2022Version 1.3.0 adds improved Node.js ESM support for tiny-invariant, mainly by changing how the package is built and exported. It also bumps a large set of development dependencies and refreshes CI/test tooling and configuration.
Featuresv1.2.0
10/31/2021Release 1.2.0 adds support for passing a lazy message generator to `tiny-invariant`, where the `message` argument can now be a function returning a string. This avoids computing expensive error messages unless the invariant fails. Alongside this, the build and development setup was modernized (tooling, CI, and dependencies).
Featuresv1.1.0
1/30/2020Release 1.1.0 makes tiny-invariant “TypeScript-native” by changing the invariant function typing to use TypeScript 3.7’s `asserts` so callers get proper type narrowing after a successful invariant check. It also keeps Flow support by introducing a Flow-only typing stub file. The runtime behavior is largely unchanged (it still throws with the prefix and, in non-production, includes the optional message).
Featuresv1.0.6
7/15/2019Release v1.0.6 updates the TypeScript type definition for tiny-invariant. The change relaxes the type of the first parameter to allow broader usage in TypeScript without compilation errors.
v1.0.5
7/9/2019Release 1.0.5 primarily updates the development toolchain. The release notes mention upgrading Flow to v0.102.0 and upgrading all dev dependencies, and the code diff shows those changes in package.json and yarn.lock.
v1.0.4
3/27/2019Release v1.0.4 primarily upgrades the project tooling, including Flow to 0.95.1 and several Babel/Jest/Rollup dev dependencies. It also adds a missing MIT LICENSE file and introduces published TypeScript type declarations via a new src/index.d.ts file.
Featuresv1.0.3
11/7/2018v1.0.3 is a tooling-focused release. The change is primarily updating Flow to 0.85 and bumping several development dependencies, with corresponding updates in the yarn.lock.