ts-essentials
Advanced tools
Comparing version 2.0.1 to 2.0.2
@@ -31,2 +31,6 @@ /** Essentials */ | ||
export declare type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>; | ||
/** Remove keys with `never` value from object type */ | ||
export declare type NonNever<T extends {}> = Pick<T, { | ||
[K in keyof T]: T[K] extends never ? never : K; | ||
}[keyof T]>; | ||
/** Merge 2 types, properties types from the latter override the ones defined on the former type */ | ||
@@ -33,0 +37,0 @@ export declare type Merge<M, N> = Omit<M, Extract<keyof M, keyof N>> & N; |
@@ -9,3 +9,3 @@ { | ||
], | ||
"version": "2.0.1", | ||
"version": "2.0.2", | ||
"main": "dist/index.js", | ||
@@ -12,0 +12,0 @@ "types": "dist/types.d.ts", |
@@ -34,2 +34,3 @@ <p align="center"> | ||
- [Omit](#omit) | ||
- [NonNever](#nonnever) | ||
- [Merge](#merge) | ||
@@ -122,2 +123,11 @@ - [UnionToIntersection](#uniontointersection) | ||
### NonNever | ||
Useful for purifying object types. It improves intellisense but also allows for extracting keys satisfying a conditional type. | ||
```typescript | ||
type GetDefined<TypesMap extends { [key: string]: any }> = | ||
keyof NonNever<{ [T in keyof TypesMap]: TypesMap[T] extends undefined ? never : TypesMap[T] }>; | ||
``` | ||
### Merge | ||
@@ -124,0 +134,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9629
74
230