Skip to content

Unconstrained type parameter has stricter comparability rules than extends unknown #48680

Closed
@DanielRosenwasser

Description

@DanielRosenwasser

Fine in 4.7 and 4.6

function foo<T extends unknown>() {
    let x = {};
    x as T;
}

Fine in 4.6, fails in 4.7

function foo<T>() {
    let x = {};
    x as T;
}

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