diff --git a/internal/transformers/declarations/transform.go b/internal/transformers/declarations/transform.go index 6217557d5f..be8789a10e 100644 --- a/internal/transformers/declarations/transform.go +++ b/internal/transformers/declarations/transform.go @@ -1016,7 +1016,7 @@ func (tx *DeclarationTransformer) ensureType(node *ast.Node, ignorePrivate bool) // Should be removed createTypeOfDeclaration will actually now reuse the existing annotation so there is no real need to duplicate type walking // Left in for now to minimize diff during syntactic type node builder refactor - if !ast.IsExportAssignment(node) && !ast.IsBindingElement(node) && node.Type() != nil && (!ast.IsParameter(node) || !tx.resolver.RequiresAddingImplicitUndefined(node, nil, tx.enclosingDeclaration)) { + if !ast.IsExportAssignment(node) && !ast.IsBindingElement(node) && node.Type() != nil && (!ast.IsParameter(node) || !tx.resolver.RequiresAddingImplicitUndefined(node, nil, node.Parent)) { return tx.Visitor().Visit(node.Type()) }