mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-11-18 20:11:14 +00:00
Check for this.xxx access to previously declared uninitialized property
This commit is contained in:
1 parent
728d9cb911
commit
5bb6487bef
1 file changed
+1
-1
@@ -1366,7 +1366,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