Skip to content

the types 'T' and 'typeof Class' have no overlapΒ #44645

Open
@karikera

Description

@karikera

Bug Report

πŸ”Ž Search Terms

template class no overlap label:Bug

πŸ•— Version & Regression Information

4.3.4 / 4.4.0-dev.20210617 / Nightly Playground

⏯ Playground Link

Playground Link

πŸ’» Code

class Class {
    dummy = 0;
}


function test<T>(a:T):void{
    if (a === Class) {} // This condition will always return 'false' since the types 'T' and 'typeof Class' have no overlap.ts(2367)
}

πŸ™ Actual behavior

ts2367 error. a can be Class

πŸ™‚ Expected behavior

no error. a can be Class

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScript

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions