From 212ea87fbb19929f20edfeb5f6613f007f81afe7 Mon Sep 17 00:00:00 2001 From: Jeroen Akkerman Date: Tue, 23 Apr 2019 22:43:46 +0200 Subject: [PATCH] Allow `null` and `undefined` as start parameter. (#34896) According to the documentation, this indicates "now". --- types/countdown/countdown-tests.ts | 3 +++ types/countdown/index.d.ts | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/types/countdown/countdown-tests.ts b/types/countdown/countdown-tests.ts index 345a4be5ed..45ea302a2f 100644 --- a/types/countdown/countdown-tests.ts +++ b/types/countdown/countdown-tests.ts @@ -6,6 +6,9 @@ let interval: number; ts = countdown(new Date()); ts = countdown(150); +ts = countdown(undefined, Date.now() + 60000); +ts = countdown(Date.now() - 60000, null); + interval = countdown(new Date(), function (ts: countdown.Timespan) { document.getElementById('pageTimer').innerHTML = ts.toHTML('strong'); diff --git a/types/countdown/index.d.ts b/types/countdown/index.d.ts index 9b00293185..b5b3d5359c 100644 --- a/types/countdown/index.d.ts +++ b/types/countdown/index.d.ts @@ -1,11 +1,11 @@ // Type definitions for countdown.js // Project: http://countdownjs.org/ -// Definitions by: Gabriel Juchault +// Definitions by: Gabriel Juchault , Ionaru // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare namespace countdown { type DateFunction = (timespan: Timespan) => void; - type DateTime = number | Date | DateFunction; + type DateTime = number | Date | DateFunction | null | undefined; interface Timespan { start?: Date;