Skip to content

use instanceof with a interface got compilation error #19120

@rdkmaster

Description

@rdkmaster

TypeScript Version: 2.5.3

Code

export interface ISlicedTableData {
    origin: RawTableData;
}

if (tableData instanceof ISlicedTableData) { // <- compilation error here.

}

Expected behavior:
no compilation error, and ts checks tableData is a implementation of ISlicedTableData or not

Actual behavior:

compilation error:  'ISlicedTableData' only refers to a type, but is being used as a value here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Working as IntendedThe behavior described is the intended behavior; this is not a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions