Skip to content

Getter returning this type guard does not work #6994

@masaeedu

Description

@masaeedu

It would be useful for getter properties to be able to use this type guards:

interface A { a: string; }
class B {
    get isA(): this is A { ... }
}

var b = new B();

if (b.isA) {
    let x = b.a; // Compile error
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    By DesignDeprecated - use "Working as Intended" or "Design Limitation" insteadRevisitAn issue worth coming back to

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions