github-pages-deploy-action/node_modules/make-error/index.d.ts

48 lines
947 B
TypeScript
Raw Normal View History

2020-01-28 13:07:56 +08:00
/**
* Create a new error constructor instance.
*/
2020-03-22 05:13:25 +08:00
declare function makeError(
name: string
): makeError.Constructor<makeError.BaseError>;
2020-01-28 13:07:56 +08:00
/**
* Set the constructor prototype to `BaseError`.
*/
2020-03-22 05:13:25 +08:00
declare function makeError<T extends Error>(super_: {
new (...args: any[]): T;
}): makeError.Constructor<T & makeError.BaseError>;
2020-01-28 13:07:56 +08:00
/**
* Create a specialized error instance.
*/
2020-03-22 05:13:25 +08:00
declare function makeError<T extends Error, K>(
name: string | Function,
super_: K
): K & makeError.SpecializedConstructor<T>;
2020-01-28 13:07:56 +08:00
2020-03-22 05:13:25 +08:00
declare namespace makeError {
2020-01-28 13:07:56 +08:00
/**
* Use with ES2015+ inheritance.
*/
2020-03-22 05:13:25 +08:00
export class BaseError extends Error {
2020-01-28 13:07:56 +08:00
message: string;
name: string;
stack: string;
constructor(message?: string);
}
2020-03-22 05:13:25 +08:00
export interface Constructor<T> {
2020-01-28 13:07:56 +08:00
new (message?: string): T;
2020-03-22 05:13:25 +08:00
super_: any;
prototype: T;
2020-01-28 13:07:56 +08:00
}
2020-03-22 05:13:25 +08:00
export interface SpecializedConstructor<T> {
super_: any;
prototype: T;
2020-01-28 13:07:56 +08:00
}
}
export = makeError;