Skip to content

Object.defineProperty doesn't define properties on 'this' #28694

Open
@DanielRosenwasser

Description

@DanielRosenwasser
// @ts-check

class C {
  constructor() {
    Object.defineProperty(this, "x", { value: "hello" });

    this.x.toLowerCase();
  }
}

Expected: No error.
Actual: Property 'x' does not exist on type 'C'.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Awaiting More FeedbackThis means we'd like to hear from more people who would be helped by this featureDomain: JavaScriptThe issue relates to JavaScript specificallySuggestionAn idea for TypeScript

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions