้•œๅƒ็ซ™็‚น ยท ๆœฌ้กต็”ฑ็ฌฌไธ‰ๆ–น GitHub ๅช่ฏป้•œๅƒๆไพ›๏ผŒ้ž GitHub ๅฎ˜ๆ–น็ซ™็‚น๏ผŒไธๆŽฅๅ—ไปปไฝ•็™ปๅฝ•ๆˆ–ๅ‡ญๆฎ่พ“ๅ…ฅใ€‚ๅ‰ๅพ€ github.com
Skip to content

Typescript 4.7.3 bracketed class property compilation error strictPropertyInitialization:trueย #49594

Description

@BzenkoSergey

Bug Report

๐Ÿ”Ž Search Terms

strictPropertyInitialization bracketed class property

๐Ÿ•— Version & Regression Information

Typescript 4.7.3, 4.7.2

โฏ Playground Link

Playground link with relevant code

๐Ÿ’ป Code

enum A {
  A = 'A',
  B = 'B'
}

class B {
  [A.A]: string;

  constructor() {
    this[A.A] = '1';
    this.A = '1';
    this['A'] = '1';
  }
}

๐Ÿ™ Actual behavior

Compilation error:
Error: Property '[A.A]' has no initializer and is not definitely assigned in the constructor.

๐Ÿ™‚ Expected behavior

Seems it should be compiled without errors.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptHelp WantedYou can do this

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions