From 915c23637e1927d2c95a1c3d32e6aacf6427fa3e Mon Sep 17 00:00:00 2001 From: Kevin Montag Date: Mon, 18 Feb 2019 11:49:18 +0100 Subject: [PATCH 1/2] Add null to possible return types of interval intersection --- types/luxon/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/luxon/index.d.ts b/types/luxon/index.d.ts index eebf89497d..44165c06c3 100644 --- a/types/luxon/index.d.ts +++ b/types/luxon/index.d.ts @@ -426,7 +426,7 @@ export class Interval { engulfs(other: Interval): boolean; equals(other: Interval): boolean; hasSame(unit: DurationUnit): boolean; - intersection(other: Interval): Interval; + intersection(other: Interval): Interval | null; isAfter(dateTime: DateTime): boolean; isBefore(dateTime: DateTime): boolean; isEmpty(): boolean; From 88a3b15d7970375349d23796b2c6ec8b09cb8090 Mon Sep 17 00:00:00 2001 From: Kevin Montag Date: Mon, 18 Feb 2019 12:08:20 +0100 Subject: [PATCH 2/2] Add tests for intersection --- types/luxon/luxon-tests.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/luxon/luxon-tests.ts b/types/luxon/luxon-tests.ts index 59566c35c3..ecf49e2081 100644 --- a/types/luxon/luxon-tests.ts +++ b/types/luxon/luxon-tests.ts @@ -140,6 +140,7 @@ i.length('years'); // $ExpectType number i.contains(DateTime.local(2019)); // $ExpectType boolean i.set({end: DateTime.local(2020)}); // $ExpectType Interval i.mapEndpoints((d) => d); // $ExpectType Interval +i.intersection(i); // $ExpectType Interval | null i.toISO(); // $ExpectType string i.toString(); // $ExpectType string