Skip to content

Allow negated types + F-bounded mapped types #18280

Closed

Description

Edit: keyof works as I thought; mapped types are just broken in interfaces. I also clarified a few things.

Allowing negated types and F-bounded mapped type variables would solve several issues:

Here's my proposal:

  1. Allow negated types, using !T to represent the set of all types that do not conform to T (i.e. not assignable to T). This is pretty simple to digest.

  2. Expand mapped types to allow the key variable to be F-bounded, like in {[P in Keys<T, P>]: ...}.

The first is sufficient to cover subtraction types and Promise type issues, and the other two make mapped conditional types possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    DuplicateAn existing issue was already created

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions