Omit Type
In the definition of Omit, we have:
type Omit<T, K extends keyof any> = Pick<T, Exclude<keyof T, K>>;
However, I assume this definition is incorrect because we are trying to exclude some keys (K) from the type (T), but K is defined as K extends keyof any. I believe it should be K extends keyof T instead, so that we only allow keys from T to be excluded from T.
🙁 Actual behavior
type Omit<T, K extends keyof any> = Pick<T, Exclude<keyof T, K>>;
🙂 Expected behavior
type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
This is working as intended: https://github.com/microsoft/typescript/wiki/faq#add-a-key-constraint-to-omit
This issue has been marked as "Working as Intended" and has seen no recent activity. It has been automatically closed for house-keeping purposes.