Back to Explore

alexreardon/tiny-invariant

GitHub
1 watchersOpen source

Last release: 2/23/2024

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

AI-generated from public sources. May be inaccurate. Report

Recent updates

  • v1.3.3

    2/23/2024

    Release 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/2024

    Release 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.

    Features
  • v1.3.1

    9/28/2022

    v1.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/2022

    Version 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.

    Features
  • v1.2.0

    10/31/2021

    Release 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).

    Features
  • v1.1.0

    1/30/2020

    Release 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).

    Features
  • v1.0.6

    7/15/2019

    Release 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/2019

    Release 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/2019

    Release 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.

    Features
  • v1.0.3

    11/7/2018

    v1.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.