We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
strictPropertyInitialization bracketed class property
Typescript 4.7.3, 4.7.2
Playground link with relevant code
enum A { A = 'A', B = 'B' } class B { [A.A]: string; constructor() { this[A.A] = '1'; this.A = '1'; this['A'] = '1'; } }
Compilation error: Error: Property '[A.A]' has no initializer and is not definitely assigned in the constructor.
Seems it should be compiled without errors.
The text was updated successfully, but these errors were encountered:
Probably related to #45974 aka "Control-Flow Analysis for Bracketed Element Access". Could you please edit your post to fill out the bug report template to help the TS team?
Sorry, something went wrong.
@RyanCavanaugh still not working
https://www.typescriptlang.org/play?ts=4.8.4#code/KYOwrgtgBAglDeBYAUFWUC8UDkNsBoU0AhTHY7FAXxRQGMAbAQwGcWpSlUoBtGAOhgBdAFxQWAFwBOASxABzANy1udAPYhJUsHQlqpACgCUCImigSAFjJZ9BQstgCM2ZdzRWbgxy7fmL1ra42A5Yzq5mNMhUQA
It works in nightly. You have the Playground set to a build that was produced before the PR was merged.
Successfully merging a pull request may close this issue.
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
π 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.
The text was updated successfully, but these errors were encountered: