Skip to content

Class expressions should support in and out variance modifiers #48618

Closed
@DanielRosenwasser

Description

@DanielRosenwasser

Likely an oversight but

let Anon = class <out T> {
    foo(): InstanceType<(typeof Anon<T>)> {
        return this;
    }
}

let OuterC = class C<out T> {
    foo(): C<T> {
        return this;
    }
}

Results in the following message:

error! 'out' modifier can only appear on a type parameter of a class, interface or type alias

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptFix AvailableA PR has been opened for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions