ts-invariant

  • Version 0.10.3
  • Published
  • 28.5 kB
  • 1 dependency
  • MIT license

Install

npm i ts-invariant
yarn add ts-invariant
pnpm add ts-invariant

Overview

TypeScript implementation of invariant(condition, message)

Index

Variables

variable verbosityLevels

const verbosityLevels: readonly ['debug', 'log', 'warn', 'error', 'silent'];

    Functions

    function invariant

    invariant: typeof invariant;

      function setVerbosity

      setVerbosity: (level: VerbosityLevel) => VerbosityLevel;

        Classes

        class InvariantError

        class InvariantError extends Error {}

          constructor

          constructor(message?: string | number);

            property framesToPop

            framesToPop: number;

              property name

              name: string;

                Type Aliases

                type ConsoleMethodName

                type ConsoleMethodName = Exclude<VerbosityLevel, 'silent'>;

                  type VerbosityLevel

                  type VerbosityLevel = typeof verbosityLevels[number];

                    Namespaces

                    namespace invariant

                    namespace invariant {}

                      variable debug

                      const debug: {
                      (...data: any[]): void;
                      (message?: any, ...optionalParams: any[]): void;
                      };

                        variable error

                        const error: {
                        (...data: any[]): void;
                        (message?: any, ...optionalParams: any[]): void;
                        };

                          variable log

                          const log: {
                          (...data: any[]): void;
                          (message?: any, ...optionalParams: any[]): void;
                          };

                            variable warn

                            const warn: {
                            (...data: any[]): void;
                            (message?: any, ...optionalParams: any[]): void;
                            };

                              Package Files (1)

                              Dependencies (1)

                              Dev Dependencies (2)

                              Peer Dependencies (0)

                              No peer dependencies.

                              Badge

                              To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                              You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/ts-invariant.

                              • Markdown
                                [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/ts-invariant)
                              • HTML
                                <a href="https://www.jsdocs.io/package/ts-invariant"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>