@types/assert

  • Version 1.5.11
  • Published
  • 7.51 kB
  • No dependencies
  • MIT license

Install

npm i @types/assert
yarn add @types/assert
pnpm add @types/assert

Overview

TypeScript definitions for assert

Index

Variables

variable strict

const strict: Omit<
typeof assert,
| 'equal'
| 'notEqual'
| 'deepEqual'
| 'notDeepEqual'
| 'ok'
| 'strictEqual'
| 'deepStrictEqual'
| 'ifError'
| 'strict'
> & {
(value: any, message?: string | Error): asserts value;
equal: <T>(
actual: any,
expected: T,
message?: string | Error
) => asserts actual is T;
notEqual: (actual: any, expected: any, message?: string | Error) => void;
deepEqual: <T>(
actual: any,
expected: T,
message?: string | Error
) => asserts actual is T;
notDeepEqual: (actual: any, expected: any, message?: string | Error) => void;
ok: (value: any, message?: string | Error) => asserts value;
strictEqual: <T>(
actual: any,
expected: T,
message?: string | Error
) => asserts actual is T;
deepStrictEqual: <T>(
actual: any,
expected: T,
message?: string | Error
) => asserts actual is T;
ifError: (value: any) => asserts value is null;
strict: Omit<
typeof assert,
| 'equal'
| 'notEqual'
| 'deepEqual'
| 'notDeepEqual'
| 'ok'
| 'strictEqual'
| 'deepStrictEqual'
| 'ifError'
| 'strict'
> &
any;
};

    Functions

    function assert

    assert: typeof assert;
    • An alias of assert.ok().

    function deepEqual

    deepEqual: (actual: any, expected: any, message?: string | Error) => void;
    • Deprecated

      since v9.9.0 - use deepStrictEqual() instead.

    function deepStrictEqual

    deepStrictEqual: <T>(
    actual: any,
    expected: T,
    message?: string | Error
    ) => asserts actual is T;

      function doesNotMatch

      doesNotMatch: (value: string, regExp: RegExp, message?: string | Error) => void;

        function doesNotReject

        doesNotReject: {
        (
        block: (() => Promise<any>) | Promise<any>,
        message?: string | Error
        ): Promise<void>;
        (
        block: Promise<any> | (() => Promise<any>),
        error: AssertPredicate,
        message?: string | Error
        ): Promise<void>;
        };

          function doesNotThrow

          doesNotThrow: {
          (block: () => any, message?: string | Error): void;
          (block: () => any, error: AssertPredicate, message?: string | Error): void;
          };

            function equal

            equal: (actual: any, expected: any, message?: string | Error) => void;
            • Deprecated

              since v9.9.0 - use strictEqual() instead.

            function fail

            fail: {
            (message?: string | Error): never;
            (
            actual: any,
            expected: any,
            message?: string | Error,
            operator?: string,
            stackStartFn?: Function
            ): never;
            };
            • Deprecated

              since v10.0.0 - use fail([message]) or other assert functions instead.

            function ifError

            ifError: (value: any) => asserts value is null;

              function match

              match: (value: string, regExp: RegExp, message?: string | Error) => void;

                function notDeepEqual

                notDeepEqual: (actual: any, expected: any, message?: string | Error) => void;
                • Deprecated

                  since v9.9.0 - use notDeepStrictEqual() instead.

                function notDeepStrictEqual

                notDeepStrictEqual: (
                actual: any,
                expected: any,
                message?: string | Error
                ) => void;

                  function notEqual

                  notEqual: (actual: any, expected: any, message?: string | Error) => void;
                  • Deprecated

                    since v9.9.0 - use notStrictEqual() instead.

                  function notStrictEqual

                  notStrictEqual: (actual: any, expected: any, message?: string | Error) => void;

                    function ok

                    ok: (value: any, message?: string | Error) => asserts value;

                      function rejects

                      rejects: {
                      (
                      block: (() => Promise<any>) | Promise<any>,
                      message?: string | Error
                      ): Promise<void>;
                      (
                      block: Promise<any> | (() => Promise<any>),
                      error: AssertPredicate,
                      message?: string | Error
                      ): Promise<void>;
                      };

                        function strictEqual

                        strictEqual: <T>(
                        actual: any,
                        expected: T,
                        message?: string | Error
                        ) => asserts actual is T;

                          function throws

                          throws: {
                          (block: () => any, message?: string | Error): void;
                          (block: () => any, error: AssertPredicate, message?: string | Error): void;
                          };

                            Classes

                            class AssertionError

                            class AssertionError extends Error {}

                              constructor

                              constructor(options?: {
                              message?: string | undefined;
                              actual?: any;
                              expected?: any;
                              operator?: string | undefined;
                              stackStartFn?: Function | undefined;
                              });

                                property actual

                                actual: any;

                                  property code

                                  code: string;

                                    property expected

                                    expected: any;

                                      property generatedMessage

                                      generatedMessage: boolean;

                                        property operator

                                        operator: string;

                                          Type Aliases

                                          type AssertPredicate

                                          type AssertPredicate =
                                          | RegExp
                                          | (new () => object)
                                          | ((thrown: any) => boolean)
                                          | object
                                          | Error;

                                            Package Files (1)

                                            Dependencies (0)

                                            No dependencies.

                                            Dev Dependencies (0)

                                            No dev dependencies.

                                            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/@types/assert.

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