Browse Source

feat: add DeepPartial to utility types

pull/5341/head
Arman Ozak 6 years ago
parent
commit
d4dd369bfa
  1. 9
      npm/ng-packs/packages/core/src/lib/models/utility.ts

9
npm/ng-packs/packages/core/src/lib/models/utility.ts

@ -1,4 +1,13 @@
import { TemplateRef, Type } from '@angular/core';
export type DeepPartial<T> = {
[P in keyof T]?: T[P] extends Serializable ? DeepPartial<T[P]> : T[P];
};
type Serializable = Record<
string | number | symbol,
string | number | boolean | Record<string | number | symbol, any>
>;
export type InferredInstanceOf<T> = T extends Type<infer U> ? U : never;
export type InferredContextOf<T> = T extends TemplateRef<infer U> ? U : never;

Loading…
Cancel
Save