mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-30 11:24:49 -05:00
Error on this.xxx access of previously declared but uninitialized property (#38030)
* Error on this.xxx access of previously declared but uninitialized property * Add tests * Accept new baselines
This commit is contained in:
@@ -1364,7 +1364,7 @@ namespace ts {
|
||||
return sourceFiles.indexOf(declarationFile) <= sourceFiles.indexOf(useFile);
|
||||
}
|
||||
|
||||
if (declaration.pos <= usage.pos) {
|
||||
if (declaration.pos <= usage.pos && !(isPropertyDeclaration(declaration) && isThisProperty(usage.parent) && !declaration.initializer && !declaration.exclamationToken)) {
|
||||
// declaration is before usage
|
||||
if (declaration.kind === SyntaxKind.BindingElement) {
|
||||
// still might be illegal if declaration and usage are both binding elements (eg var [a = b, b = b] = [1, 2])
|
||||
|
||||
Reference in New Issue
Block a user