type-plus
Advanced tools
Comparing version 1.23.1 to 1.24.0
@@ -1,2 +0,8 @@ | ||
export declare type PartialPick<T, U extends keyof T> = Pick<T, Exclude<keyof T, U>> & Partial<Pick<T, U>>; | ||
export declare type PartialExcept<T, U extends keyof T> = Pick<T, U> & Partial<Pick<T, Exclude<keyof T, U>>>; | ||
import { Pick } from './pick'; | ||
import { UnionKeys } from './UnionKeys'; | ||
export declare type PartialPick<T, U extends UnionKeys<T>> = T extends T ? Pick<T, Exclude<keyof T, U>> & Partial<Pick<T, U>> : never; | ||
/** | ||
* @deprecated replaced by `PartialOmit` | ||
*/ | ||
export declare type PartialExcept<T, U extends UnionKeys<T>> = T extends T ? Pick<T, U> & Partial<Pick<T, Exclude<keyof T, U>>> : never; | ||
export declare type PartialOmit<T, U extends UnionKeys<T>> = T extends T ? Pick<T, U> & Partial<Pick<T, Exclude<keyof T, U>>> : never; |
@@ -1,2 +0,8 @@ | ||
export declare type PartialPick<T, U extends keyof T> = Pick<T, Exclude<keyof T, U>> & Partial<Pick<T, U>>; | ||
export declare type PartialExcept<T, U extends keyof T> = Pick<T, U> & Partial<Pick<T, Exclude<keyof T, U>>>; | ||
import { Pick } from './pick'; | ||
import { UnionKeys } from './UnionKeys'; | ||
export declare type PartialPick<T, U extends UnionKeys<T>> = T extends T ? Pick<T, Exclude<keyof T, U>> & Partial<Pick<T, U>> : never; | ||
/** | ||
* @deprecated replaced by `PartialOmit` | ||
*/ | ||
export declare type PartialExcept<T, U extends UnionKeys<T>> = T extends T ? Pick<T, U> & Partial<Pick<T, Exclude<keyof T, U>>> : never; | ||
export declare type PartialOmit<T, U extends UnionKeys<T>> = T extends T ? Pick<T, U> & Partial<Pick<T, Exclude<keyof T, U>>> : never; |
{ | ||
"name": "type-plus", | ||
"version": "1.23.1", | ||
"version": "1.24.0", | ||
"description": "Provides additional types for `typescript`.", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/unional/type-plus", |
@@ -63,4 +63,5 @@ # type-plus | ||
- `Omit<T, K>`: From `T`, pick a set of properties whose keys are not in the union `K`. This is the opposite of `Pick<T, K>`. | ||
- `PartialExcept<T, U>`: Deprecated. Same as `PartialOmit<T, U>`. | ||
- `PartialOmit<T, U>`: makes the properties not specified in `U` becomes optional. | ||
- `PartialPick<T, U>`: makes the properties specified in `U` becomes optional. | ||
- `PartialExcept<T, U>`: makes the properties not specified in `U` becomes optional. | ||
- `RecursivePartial<T>`: make type `T` optional recursively. | ||
@@ -67,0 +68,0 @@ - `RecursiveRequired<T>`: make type `T` required recursively. |
@@ -1,2 +0,2 @@ | ||
import { PartialExcept, PartialPick, typeAssert } from '.'; | ||
import { PartialExcept, PartialPick, typeAssert, PartialOmit } from '.'; | ||
@@ -17,3 +17,3 @@ test('make picked properties optional', () => { | ||
test('make not picked properties optional', () => { | ||
test('make not specified properties optional', () => { | ||
type Foo = { | ||
@@ -25,2 +25,3 @@ a: number, | ||
// tslint:disable-next-line: deprecation | ||
let y: PartialExcept<Foo, 'a'> = {} as any | ||
@@ -32,1 +33,16 @@ | ||
}) | ||
test('make not specified properties optional', () => { | ||
type Foo = { | ||
a: number, | ||
b: number, | ||
c: number | ||
} | ||
let y: PartialOmit<Foo, 'a'> = {} as any | ||
typeAssert.noUndefined(y.a) | ||
y.b = undefined | ||
y.c = undefined | ||
}) |
@@ -1,3 +0,11 @@ | ||
export type PartialPick<T, U extends keyof T> = Pick<T, Exclude<keyof T, U>> & Partial<Pick<T, U>> | ||
import { Pick } from './pick'; | ||
import { UnionKeys } from './UnionKeys'; | ||
export type PartialExcept<T, U extends keyof T> = Pick<T, U> & Partial<Pick<T, Exclude<keyof T, U>>> | ||
export type PartialPick<T, U extends UnionKeys<T>> = T extends T ? Pick<T, Exclude<keyof T, U>> & Partial<Pick<T, U>> : never | ||
/** | ||
* @deprecated replaced by `PartialOmit` | ||
*/ | ||
export type PartialExcept<T, U extends UnionKeys<T>> = T extends T ? Pick<T, U> & Partial<Pick<T, Exclude<keyof T, U>>> : never | ||
export type PartialOmit<T, U extends UnionKeys<T>> = T extends T ? Pick<T, U> & Partial<Pick<T, Exclude<keyof T, U>>> : never |
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
103929
1681
134