From: Alan Wang Date: Tue, 15 Sep 2020 02:24:29 +0000 (+0800) Subject: [bugfix] expose deprecation handler in typings (#5637) X-Git-Tag: 2.29.0~18 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a3824e36daca9b39dfcf1bcf4e2782b29f7eaafa;p=thirdparty%2Fmoment.git [bugfix] expose deprecation handler in typings (#5637) --- diff --git a/moment.d.ts b/moment.d.ts index 379a82444..97c29bdf1 100644 --- a/moment.d.ts +++ b/moment.d.ts @@ -760,6 +760,8 @@ declare namespace moment { export var defaultFormat: string; export var defaultFormatUtc: string; + export var suppressDeprecationWarnings: boolean; + export var deprecationHandler: ((name: string | void, msg: string) => void) | void; export var HTML5_FMT: { DATETIME_LOCAL: string, diff --git a/ts3.1-typing-tests/moment-tests.ts b/ts3.1-typing-tests/moment-tests.ts index 201b68dc9..a04d56af1 100644 --- a/ts3.1-typing-tests/moment-tests.ts +++ b/ts3.1-typing-tests/moment-tests.ts @@ -538,3 +538,8 @@ moment.locale('en', { // console.log(moment.version); moment.defaultFormat = 'YYYY-MM-DD HH:mm'; + +moment.suppressDeprecationWarnings = true; +moment.deprecationHandler = null; +moment.deprecationHandler = undefined; +moment.deprecationHandler = function(name: string | null, msg: string) {} diff --git a/ts3.1-typings/moment.d.ts b/ts3.1-typings/moment.d.ts index 3f6bb8ed6..6b82f9953 100644 --- a/ts3.1-typings/moment.d.ts +++ b/ts3.1-typings/moment.d.ts @@ -724,7 +724,6 @@ declare namespace moment { export function calendarFormat(m: Moment, now: Moment): string; export function parseTwoDigitYear(input: string): number; - /** * Constant used to enable explicit ISO_8601 format parsing. */ @@ -734,6 +733,9 @@ declare namespace moment { export var defaultFormat: string; export var defaultFormatUtc: string; + export var suppressDeprecationWarnings: boolean; + export var deprecationHandler: ((name: string | null, msg: string) => void) | null | undefined; + export var HTML5_FMT: { DATETIME_LOCAL: string, DATETIME_LOCAL_SECONDS: string, diff --git a/typing-tests/moment-tests.ts b/typing-tests/moment-tests.ts index 929f7cc73..496d44cfc 100644 --- a/typing-tests/moment-tests.ts +++ b/typing-tests/moment-tests.ts @@ -550,3 +550,8 @@ moment.locale('en', { console.log(moment.version); moment.defaultFormat = 'YYYY-MM-DD HH:mm'; + +moment.suppressDeprecationWarnings = true; +moment.deprecationHandler = null; +moment.deprecationHandler = undefined; +moment.deprecationHandler = function(name: string | void, msg: string) {}