Allow this in constructor parameter defaults when legal (#57682)

This commit is contained in:
Ryan Cavanaugh
2024-03-25 11:20:08 -07:00
committed by GitHub
parent ac962eaa1f
commit 0d4414d10d
10 changed files with 103 additions and 74 deletions

View File

@@ -29815,12 +29815,6 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
error(node, Diagnostics.this_cannot_be_referenced_in_current_location);
// do not return here so in case if lexical this is captured - it will be reflected in flags on NodeLinks
break;
case SyntaxKind.Constructor:
if (isInConstructorArgumentInitializer(node, container)) {
error(node, Diagnostics.this_cannot_be_referenced_in_constructor_arguments);
// do not return here so in case if lexical this is captured - it will be reflected in flags on NodeLinks
}
break;
}
}

View File

@@ -1836,10 +1836,6 @@
"category": "Error",
"code": 2332
},
"'this' cannot be referenced in constructor arguments.": {
"category": "Error",
"code": 2333
},
"'this' cannot be referenced in a static property initializer.": {
"category": "Error",
"code": 2334