ts-base-error
TypeScript icon, indicating that this package has built-in type declarations

1.0.5 • Public • Published

TypeScript Base Extendible Error

NPM: https://www.npmjs.com/package/ts-base-error

Usage Example

index.ts

import BaseError from 'ts-base-error';
 
class Err1 extends BaseError {}
const e1 = new Err1();
console.log(e1 instanceof Err1); // true
console.log(e1 instanceof Error); // true
 
class Err2 extends Err1 {}
const e2 = new Err2();
console.log(e2 instanceof Err1); // true
console.log(e2 instanceof Err2); // true
console.log(e2 instanceof Error); // true
 
class NoBaseErr extends Error {}
const x = new NoBaseErr();
console.log(x instanceof Error); // true
console.log(x instanceof NoBaseErr); // false !!!

Test

npx ts-node test.ts

Problems

Class constructor error

/ts-base-error/

    Package Sidebar

    Install

    npm i ts-base-error

    Weekly Downloads

    27

    Version

    1.0.5

    License

    SEE LICENSE IN LICENCE

    Unpacked Size

    10.3 kB

    Total Files

    10

    Last publish

    Collaborators

    • reduardo7