Skip to content

PartialX

Category
X Series
Alias
PartialByKeys

Constructs a type by setting the properties specified by K(string literal or union of string literals) to partial from T.

Usage

ts
import type { PartialX } from '@utype/core'

type Prop = {
  name: string;
  age: number;
  visible: boolean;
}

// Expect: { name?: string; age?: number; visible: boolean; }
type PartialXProp = PartialX<Prop, 'name' | 'age'>
// @ts-expect-error
type Error = PartialX<Prop, "sports">