From 86f66052ff7f8a33dbdd97572cefc498c016bd29 Mon Sep 17 00:00:00 2001 From: Jakub Gilis Date: Fri, 5 Jul 2024 10:25:58 +0200 Subject: [PATCH] fix: allow nullable values again Closes: #119 Angular 18 requires TS 5.4+ which breaks the NonNullable type: https://github.com/microsoft/TypeScript/issues/56644 This reintroduces issue #81. This commit replaces NonNullable with Exclude to allow correct typing of ExtractRefProp and fix the issue where opening dialogs containing undefined values throws TS2769 when trying to set the data property. --- libs/dialog/src/lib/types.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libs/dialog/src/lib/types.ts b/libs/dialog/src/lib/types.ts index a4b5fa1..f43da58 100644 --- a/libs/dialog/src/lib/types.ts +++ b/libs/dialog/src/lib/types.ts @@ -59,10 +59,11 @@ export type JustProps = Pick< }[keyof T] >; -export type ExtractRefProp = NonNullable< +export type ExtractRefProp = Exclude< { [P in keyof T]: T[P] extends DialogRef ? P : never; - }[keyof T] + }[keyof T], + undefined | null >; export type ExtractData = ExtractRefProp extends never