You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The function overload for foo appears as a statement. This violates the type constraint of StatementStructures: the FunctionOverloadDeclarationStructure, with kind StructureKind.FunctionOverload, is not a valid statement per the definition of StatementStructures.
Notably, the overload structure appears twice: once as a previous sibling of the function declaration, and once in the overloads array of the function declaration.
I am seriously considering submitting a pull request to fix this, but I'd like some guidance, @dsherret, before attempting to do so. There's some nuance to this.
One aspect I noticed a couple days ago is that simply depending on OverloadableNode.getOverloads() or OverloadableNode.getImplementation fails right now for type definition files. The code for OverloadableNode depends on the presence of a function body, which we won't have in this situation.
Some good news: ts-morph's structure printer rejects the overloads in the statements array when fed the same (albeit with a funny error message based on SyntaxKind rather than StructureKind). 🙂
Describe the bug
Version: 22.0.0
To Reproduce
Actual behavior
The function overload for
foo
appears as a statement. This violates the type constraint ofStatementStructures
: theFunctionOverloadDeclarationStructure
, with kindStructureKind.FunctionOverload
, is not a valid statement per the definition ofStatementStructures
.Notably, the overload structure appears twice: once as a previous sibling of the function declaration, and once in the overloads array of the function declaration.
Expected behavior
The overload should appear once, as a member of the function declaration's overloads array.
Obligatory ts-ast-viewer link
The text was updated successfully, but these errors were encountered: