type-challenges icon indicating copy to clipboard operation
type-challenges copied to clipboard

2757 - PartialByKeys

Open jzllove9 opened this issue 1 year ago • 0 comments

type IntersectionObj<T> = {
  [P in keyof T]: T[P]
}

type PartialByKeys<T, K extends PropertyKey = keyof T> = IntersectionObj<{
  [P in keyof T as P extends K ? P : never]?: T[P]
} & {
  [P in keyof Omit<T, K>]: T[P]
}>

jzllove9 avatar Sep 30 '24 08:09 jzllove9