Skip to content

Commit

Permalink
[bugfix] expose deprecation handler in typings (#5637)
Browse files Browse the repository at this point in the history
  • Loading branch information
Alanscut committed Sep 15, 2020
1 parent 503219e commit a3824e3
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 1 deletion.
2 changes: 2 additions & 0 deletions moment.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
5 changes: 5 additions & 0 deletions ts3.1-typing-tests/moment-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {}
4 changes: 3 additions & 1 deletion ts3.1-typings/moment.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand All @@ -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,
Expand Down
5 changes: 5 additions & 0 deletions typing-tests/moment-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {}

0 comments on commit a3824e3

Please sign in to comment.