mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-11-18 20:11:14 +00:00
fix(53933): Confusing rules around function parameter names in a type (#53946)
This commit is contained in:
1 parent
d7c2670898
commit
60ce788302
6 files changed
+33
-11
No files matched your search
@@ -42152,7 +42152,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
|
||||
forEach(node.name.elements, checkSourceElement);
|
||||
}
|
||||
// For a parameter declaration with an initializer, error and exit if the containing function doesn't have a body
|
||||
if (isParameter(node) && node.initializer && nodeIsMissing((getContainingFunction(node) as FunctionLikeDeclaration).body)) {
|
||||
if (node.initializer && isParameterDeclaration(node) && nodeIsMissing((getContainingFunction(node) as FunctionLikeDeclaration).body)) {
|
||||
error(node, Diagnostics.A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation);
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user