Skip to content

Latest commit

 

History

History
36 lines (28 loc) · 747 Bytes

known-keys.mdx

File metadata and controls

36 lines (28 loc) · 747 Bytes
title description date authors draft
Known keys
When you need an object where all the keys are mapped to one type except some known keys that are mapped to different types.
2024-02-20
pomber
true

Sources:

type MyType = {
  [s: string]: string
  foo: number
}

When you need an object where all the keys are mapped to one type except some known keys that are mapped to different types.

Why Omit doesn't work:

type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>
interface FancyIndices {
  [x: symbol]: number
  [x: `${string}Token`]: string
}

does this work?