@types/empower
TypeScript icon, indicating that this package has built-in type declarations

1.2.35 • Public • Published

Installation

npm install --save @types/empower

Summary

This package contains type definitions for empower (https://github.com/power-assert-js/empower).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/empower.

import { Options as CoreOptions } from "empower-core";
import { Formatter } from "power-assert-formatter";

/**
 * Enhances Power Assert feature to assert function/object.
 *
 * @param originalAssert An instance of standard `assert` function or any assert-like object to enhance.
 * @param formatter A formatter function created by power-assert-formatter.
 * @param options Configuration options. If not passed, default options will be used.
 * @return Enhanced assert function/object.
 */
declare function empower<T>(originalAssert: T, formatter: Formatter, options?: empower.Options): T;

declare namespace empower {
    // The omitted options can be provided, but they will be always overridden.
    type Options = Omit<CoreOptions, "modifyMessageBeforeAssert" | "onError"> & {
        /**
         * If truthy, modify message property of `AssertionError` on rethrow.
         *
         * @default false
         */
        modifyMessageOnRethrow?: boolean | undefined;
        /**
         * If truthy, add `powerAssertContext` property to `AssertionError` on rethrow.
         *
         * @default false
         */
        saveContextOnRethrow?: boolean | undefined;
    };

    /**
     * Returns default options object for `empower` function.
     */
    function defaultOptions(): Required<Options>;
}

export = empower;

Additional Details

Credits

These definitions were written by vvakame.

Dependencies (2)

Dev Dependencies (0)

    Package Sidebar

    Install

    npm i @types/empower

    Weekly Downloads

    18,842

    Version

    1.2.35

    License

    MIT

    Unpacked Size

    5.41 kB

    Total Files

    5

    Last publish

    Collaborators

    • types