Skip to content

Omit Type  #61408

@mamadshni

Description

@mamadshni

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>>;

Metadata

Metadata

Assignees

No one assigned

    Labels

    Working as IntendedThe behavior described is the intended behavior; this is not a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions