UNPKG

1.65 kBTypeScriptView Raw
1// Type definitions for depd 1.1
2// Project: https://github.com/dougwilson/nodejs-depd
3// Definitions by: Zhiyuan Wang <https://github.com/danny8002>
4// BendingBender <https://github.com/BendingBender>
5// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
6// TypeScript Version: 2.2
7
8/// <reference types="node" />
9
10export = depd;
11
12declare function depd(namespace: string): depd.Deprecate;
13
14declare namespace depd {
15 interface Deprecate {
16 (message: string): void;
17 // tslint:disable-next-line ban-types
18 function<T extends Function>(fn: T, message?: string): T;
19 property<T extends object>(obj: T, prop: keyof T, message: string): void;
20 }
21
22 interface DeprecationError extends Error {
23 readonly name: 'DeprecationError';
24 namespace: string;
25 stack: string;
26 }
27}
28
29declare global {
30 namespace NodeJS {
31 interface Process {
32 addListener(event: 'deprecation', listener: (deprecationError: depd.DeprecationError) => void): this;
33 emit(event: 'deprecation', code: depd.DeprecationError): boolean;
34 on(event: 'deprecation', listener: (deprecationError: depd.DeprecationError) => void): this;
35 once(event: 'deprecation', listener: (deprecationError: depd.DeprecationError) => void): this;
36 prependListener(event: 'deprecation', listener: (deprecationError: depd.DeprecationError) => void): this;
37 prependOnceListener(event: 'deprecation', listener: (deprecationError: depd.DeprecationError) => void): this;
38 listeners(event: 'deprecation'): depd.DeprecationError[];
39 }
40 }
41}