Skip to content

typeof on #private Fields #14451

@magic-akari

Description

@magic-akari

💻

  • Would you like to work on this feature?

What problem are you trying to solve?

TypeScript 4.7 now allows us to perform typeof queries on private fields.

class Container {
    #data = "hello!";

    get data(): typeof this.#data {
        return this.#data;
    }

    set data(value: typeof this.#data) {
        this.#data = value;
    }
}

Describe the solution you'd like

Describe alternatives you've considered

Documentation, Adoption, Migration Strategy

https://devblogs.microsoft.com/typescript/announcing-typescript-4-7-beta/#typeof-on-private-fields

Metadata

Metadata

Assignees

No one assigned

    Labels

    i: needs triageoutdatedA closed issue/PR that is archived due to age. Recommended to make a new issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions