From d4dd369bfa7e30173f72de247597c147d33acef2 Mon Sep 17 00:00:00 2001 From: Arman Ozak Date: Tue, 8 Sep 2020 18:51:02 +0300 Subject: [PATCH] feat: add DeepPartial to utility types --- npm/ng-packs/packages/core/src/lib/models/utility.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/npm/ng-packs/packages/core/src/lib/models/utility.ts b/npm/ng-packs/packages/core/src/lib/models/utility.ts index e84ad15340..228cab0de3 100644 --- a/npm/ng-packs/packages/core/src/lib/models/utility.ts +++ b/npm/ng-packs/packages/core/src/lib/models/utility.ts @@ -1,4 +1,13 @@ import { TemplateRef, Type } from '@angular/core'; +export type DeepPartial = { + [P in keyof T]?: T[P] extends Serializable ? DeepPartial : T[P]; +}; + +type Serializable = Record< + string | number | symbol, + string | number | boolean | Record +>; + export type InferredInstanceOf = T extends Type ? U : never; export type InferredContextOf = T extends TemplateRef ? U : never;