Skip to content

Latest commit

 

History

History
57 lines (40 loc) · 699 Bytes

File metadata and controls

57 lines (40 loc) · 699 Bytes

typelab / utils / ObjectPartial

type ObjectPartial<T, K> = _ObjectPartial<T, K>;

Extended TypeScript `Partial` to make specific properties optional.

Type Parameters

Type Parameter Description

T

The original object type.

K extends keyof T

The keys of T that should be optional.

Returns

A type with the specified keys of T set as optional.

Example

type Obj = { a: string; b: string };

// { a?: string; b: string }
type PartialObj = ObjectPartial<Obj, 'a'>;