add missing optional code argument to util.deprecate (#38753)

introduced in node v8
This commit is contained in:
Tobias Koppers
2019-10-15 16:52:13 -07:00
committed by Andrew Branch
parent d3a7f11d86
commit 370aadf2d8
7 changed files with 15 additions and 7 deletions
+3 -1
View File
@@ -127,8 +127,10 @@ import { readFile } from 'fs';
const foo = () => {};
// $ExpectType () => void
util.deprecate(foo, 'foo() is deprecated, use bar() instead');
// $ExpectType <T extends Function>(fn: T, message: string) => T
// $ExpectType <T extends Function>(fn: T, message: string, code?: string | undefined) => T
util.deprecate(util.deprecate, 'deprecate() is deprecated, use bar() instead');
// $ExpectType <T extends Function>(fn: T, message: string, code?: string | undefined) => T
util.deprecate(util.deprecate, 'deprecate() is deprecated, use bar() instead', 'DEP0001');
// util.isDeepStrictEqual
util.isDeepStrictEqual({foo: 'bar'}, {foo: 'bar'});
+1 -1
View File
@@ -51,7 +51,7 @@ declare module "util" {
function isSymbol(object: any): object is symbol;
/** @deprecated since v4.0.0 - use `value === undefined` instead. */
function isUndefined(object: any): object is undefined;
function deprecate<T extends Function>(fn: T, message: string): T;
function deprecate<T extends Function>(fn: T, message: string, code?: string): T;
function isDeepStrictEqual(val1: any, val2: any): boolean;
interface CustomPromisify<TCustom extends Function> extends Function {
+3 -1
View File
@@ -946,8 +946,10 @@ function bufferTests() {
const foo = () => {};
// $ExpectType () => void
util.deprecate(foo, 'foo() is deprecated, use bar() instead');
// $ExpectType <T extends Function>(fn: T, message: string) => T
// $ExpectType <T extends Function>(fn: T, message: string, code?: string) => T
util.deprecate(util.deprecate, 'deprecate() is deprecated, use bar() instead');
// $ExpectType <T extends Function>(fn: T, message: string, code?: string) => T
util.deprecate(util.deprecate, 'deprecate() is deprecated, use bar() instead', 'DEP0001');
// util.isDeepStrictEqual
util.isDeepStrictEqual({foo: 'bar'}, {foo: 'bar'});
+1 -1
View File
@@ -55,7 +55,7 @@ declare module "util" {
function isSymbol(object: any): object is symbol;
/** @deprecated since v4.0.0 - use `value === undefined` instead. */
function isUndefined(object: any): object is undefined;
function deprecate<T extends Function>(fn: T, message: string): T;
function deprecate<T extends Function>(fn: T, message: string, code?: string): T;
function isDeepStrictEqual(val1: any, val2: any): boolean;
interface CustomPromisify<TCustom extends Function> extends Function {
+1 -1
View File
@@ -5658,7 +5658,7 @@ declare module "util" {
export function isString(object: any): object is string;
export function isSymbol(object: any): object is symbol;
export function isUndefined(object: any): object is undefined;
export function deprecate<T extends Function>(fn: T, message: string): T;
export function deprecate<T extends Function>(fn: T, message: string, code?: string): T;
export interface CustomPromisify<TCustom extends Function> extends Function {
__promisify__: TCustom;
+3 -1
View File
@@ -843,8 +843,10 @@ namespace util_tests {
const foo = () => {};
// $ExpectType () => void
util.deprecate(foo, 'foo() is deprecated, use bar() instead');
// $ExpectType <T extends Function>(fn: T, message: string) => T
// $ExpectType <T extends Function>(fn: T, message: string, code?: string) => T
util.deprecate(util.deprecate, 'deprecate() is deprecated, use bar() instead');
// $ExpectType <T extends Function>(fn: T, message: string, code?: string) => T
util.deprecate(util.deprecate, 'deprecate() is deprecated, use bar() instead', 'DEP0001');
// util.TextDecoder()
var td = new util.TextDecoder();
+3 -1
View File
@@ -843,8 +843,10 @@ namespace util_tests {
const foo = () => {};
// $ExpectType () => void
util.deprecate(foo, 'foo() is deprecated, use bar() instead');
// $ExpectType <T extends Function>(fn: T, message: string) => T
// $ExpectType <T extends Function>(fn: T, message: string, code?: string) => T
util.deprecate(util.deprecate, 'deprecate() is deprecated, use bar() instead');
// $ExpectType <T extends Function>(fn: T, message: string, code?: string) => T
util.deprecate(util.deprecate, 'deprecate() is deprecated, use bar() instead', 'DEP0001');
// util.TextDecoder()
var td = new util.TextDecoder();