Comparing version 0.0.5 to 0.0.6
@@ -71,2 +71,5 @@ export declare type nil = null | undefined; | ||
export declare type WithNonUndefinedKeys<T, K extends keyof T> = Omit<T, K> & NonUndefinedProps<Pick<T, K>>; | ||
export declare type DeepPartial<T> = { | ||
[P in keyof T]?: T[P] extends Array<infer I> ? Array<DeepPartial<I>> : DeepPartial<T[P]>; | ||
}; | ||
export declare type DiffObjects<T, U> = Omit<T, keyof U>; | ||
@@ -73,0 +76,0 @@ export declare type UnionObjects<T extends AnyObject, U extends AnyObject> = DiffObjects<T, U> & { |
@@ -71,2 +71,5 @@ export declare type nil = null | undefined; | ||
export declare type WithNonUndefinedKeys<T, K extends keyof T> = Omit<T, K> & NonUndefinedProps<Pick<T, K>>; | ||
export declare type DeepPartial<T> = { | ||
[P in keyof T]?: T[P] extends Array<infer I> ? Array<DeepPartial<I>> : DeepPartial<T[P]>; | ||
}; | ||
export declare type DiffObjects<T, U> = Omit<T, keyof U>; | ||
@@ -73,0 +76,0 @@ export declare type UnionObjects<T extends AnyObject, U extends AnyObject> = DiffObjects<T, U> & { |
{ | ||
"name": "tsdef", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"description": "TypeScript common pattern shortcut definitions / utility gist library", | ||
@@ -5,0 +5,0 @@ "main": "es5/index.js", |
@@ -157,2 +157,11 @@ # tsdef | ||
// make all properties optional recursively including nested objects. | ||
// keep in mind that this should be used on json / plain objects only. | ||
// otherwise, it will make class methods optional as well. | ||
export type DeepPartial<T> = { | ||
[P in keyof T]?: T[P] extends Array<infer I> | ||
? Array<DeepPartial<I>> | ||
: DeepPartial<T[P]> | ||
}; | ||
// first object properties excluding common keys with second object | ||
@@ -313,3 +322,4 @@ export type DiffObjects<T, U> = Omit<T, keyof U>; | ||
## Contribute | ||
Pull Requests are welcome! Just try to be consistent with existing naming conventions and coding styles. | ||
Pull Requests are welcome! | ||
Just try to be consistent with existing naming conventions and coding styles. | ||
Names must be concise, easy to read, and precisely descriptive. | ||
@@ -316,0 +326,0 @@ I've setup prettier, so make sure your codes are auto formatted according to my prettier setup. |
25162
220
328