Skip to content

Support TypeScript 4.7 in and out variance annotations #14442

@DanielRosenwasser

Description

@DanielRosenwasser

💻

  • Would you like to work on this feature?

What problem are you trying to solve?

TypeScript 4.7 Beta ships with in and out modifiers for type parameters on type declarations.

type Getter<out T> = () => T;

type Setter<in T> = (value: T) => void;

interface State<in out T> {
    get: () => T;
    set: (value: T) => void;
}

TypeScript developers using Babel will need to support this syntax.

These in and out modifiers can only be placed on type parameter declarations for

It is possible to have in, out, and in out. Duplicates are not allowed, and in must always come before out.

Describe the solution you'd like

For the next minor version of Babel, we may want to implement this feature.

Describe alternatives you've considered

There are alternative compilers, but that would not be ideal for Babel users.

Documentation, Adoption, Migration Strategy

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    i: needs triageoutdatedA closed issue/PR that is archived due to age. Recommended to make a new issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions