@types/check-error
TypeScript definitions for check-error
Last updated 7 years ago by types .
MIT · Repository · Original npm · Tarball · package.json
$ cnpm install @types/check-error 
SYNC missed versions from official npm registry.

Installation

npm install --save @types/check-error

Summary

This package contains type definitions for check-error (https://github.com/chaijs/check-error#readme).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/check-error.

index.d.ts

// Type definitions for check-error 1.0
// Project: https://github.com/chaijs/check-error#readme
// Definitions by: Porama Ignoi Ruengrairatanaroj <https://github.com/Seally>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.1

export type ErrorInstanceOrConstructor =
    | Error
    | {
        new(...args: any[]): Error;
    }
    | {
        (...args: any[]): Error;
    };

/**
 * Checks if two instances are compatible (strict equal).
 *
 * Returns false if errorLike is not an instance of Error, because instances
 * can only be compatible if they're both error instances.
 *
 * @param thrown - thrown error
 * @param errorLike - error object to compare against
 */
export function compatibleInstance(thrown: Error, errorLike: Error): boolean;

/**
 * Checks if two constructors are compatible.
 *
 * This function can receive either an error constructor or an error
 * instance as the `errorLike` argument.
 *
 * Constructors are compatible if they're the same or if one is an instance
 * of another.
 *
 * @param thrown - error
 * @param errorLike - object to compare against
 */
export function compatibleConstructor(thrown: Error, errorLike: ErrorInstanceOrConstructor): boolean;

/**
 * Checks if an error's message is compatible with a matcher (String or
 * RegExp).
 *
 * If the message contains the String or passes the RegExp test,
 * it is considered compatible.
 *
 * @param thrown - thrown error
 * @param errMatcher - string/regex to look for in the message
 */
export function compatibleMessage(thrown: Error | string, errMatcher: string | RegExp): boolean;

/**
 * Gets the error message from an error.
 *
 * If `err` is a String itself, we return it.
 * If the error has no message, we return an empty string.
 *
 * @param err
 */
export function getMessage(err: Error | string): string;

/**
 * Gets the constructor name for an Error instance or constructor itself.
 */
export function getConstructorName(errorLike: ErrorInstanceOrConstructor): string;

Additional Details

  • Last updated: Mon, 04 Sep 2023 15:40:45 GMT
  • Dependencies: none
  • Global values: none

Credits

These definitions were written by Porama Ignoi Ruengrairatanaroj.

Current Tags

  • 1.0.1                                ...           latest (3 years ago)
  • 1.0.0                                ...           ts2.1 (7 years ago)
  • 1.0.0                                ...           ts2.2 (7 years ago)
  • 1.0.0                                ...           ts2.3 (7 years ago)
  • 1.0.0                                ...           ts2.4 (7 years ago)
  • 1.0.0                                ...           ts2.5 (7 years ago)
  • 1.0.0                                ...           ts2.6 (7 years ago)
  • 1.0.0                                ...           ts2.7 (7 years ago)
  • 1.0.0                                ...           ts2.8 (7 years ago)
  • 1.0.0                                ...           ts2.9 (7 years ago)
  • 1.0.0                                ...           ts3.0 (7 years ago)
  • 1.0.0                                ...           ts3.1 (7 years ago)
  • 1.0.0                                ...           ts3.2 (7 years ago)
  • 1.0.0                                ...           ts3.3 (7 years ago)
  • 1.0.0                                ...           ts3.4 (7 years ago)
  • 1.0.0                                ...           ts3.5 (7 years ago)
  • 1.0.0                                ...           ts3.6 (7 years ago)
  • 1.0.0                                ...           ts3.7 (7 years ago)
  • 1.0.0                                ...           ts3.8 (7 years ago)
  • 1.0.0                                ...           ts3.9 (7 years ago)
  • 1.0.0                                ...           ts4.0 (7 years ago)
  • 1.0.0                                ...           ts4.1 (7 years ago)
  • 1.0.0                                ...           ts4.2 (7 years ago)
  • 1.0.1                                ...           ts4.3 (3 years ago)
  • 1.0.1                                ...           ts4.4 (3 years ago)
  • 1.0.1                                ...           ts4.5 (3 years ago)
  • 1.0.1                                ...           ts4.6 (3 years ago)
  • 1.0.1                                ...           ts4.7 (3 years ago)
  • 1.0.1                                ...           ts4.8 (3 years ago)
  • 1.0.1                                ...           ts4.9 (3 years ago)
  • 1.0.1                                ...           ts5.0 (3 years ago)
  • 1.0.1                                ...           ts5.1 (3 years ago)
  • 1.0.1                                ...           ts5.2 (3 years ago)
  • 1.0.1                                ...           ts5.3 (3 years ago)

2 Versions

  • 1.0.1                                ...           3 years ago
  • 1.0.0                                ...           7 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (0)
None
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2013 - present © cnpmjs.org | Home |