Skip to content

Definite assignment checks don't occur on private fields #35884

Closed
@DanielRosenwasser

Description

@DanielRosenwasser

https://www.typescriptlang.org/play/index.html?ts=3.8.0-pr-30829-97#code/MYGwhgzhAEDC0G8BQ1oGIBmB7LAuaEALgE4CWAdgOYDcSK0ARuABYAUAlIvaoc6RADpMOWqgC+SMUA

// @strictPropertyInitialization: true
// @strictNullChecks: true

class C {
  #foo: string;

  blah() {
    this.#foo;
  }
}

Expected

Property 'foo' has no initializer and is not definitely assigned in the constructor.

Actual

No error

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