Skip to content

Latest commit

 

History

History
27 lines (20 loc) · 604 Bytes

partial-x.md

File metadata and controls

27 lines (20 loc) · 604 Bytes
category alias
X Series
PartialByKeys

PartialX

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

Usage

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

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

// Expect: { name?: string; age?: number; visible: boolean; } // [!code highlight]
type PartialXProps = PartialX<Props, 'name' | 'age'>
// @ts-expect-error
type Error = PartialX<Props, "sports"> // [!code error]