twenty-one/shared/RemoveKey.ts

5 lines
No EOL
270 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// I dont understand why, but Omit (built-in) breaks discriminated unions. This type does not.
// See https://github.com/microsoft/TypeScript/issues/31501#issuecomment-1079728677
export type RemoveKey<T, K extends string> = {
[P in keyof T as Exclude<P, K>]: T[P];
}