From 6f2c0d3244dd5007dc69c75646fa1385f4155754 Mon Sep 17 00:00:00 2001 From: Benji Visser Date: Thu, 25 Apr 2024 16:29:01 -0400 Subject: [PATCH] fix type defs (#30) Signed-off-by: Benji Visser --- .../language/typescript/signatures.ts | 22 ++++--------------- 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/packages/bumpgen-core/src/services/language/typescript/signatures.ts b/packages/bumpgen-core/src/services/language/typescript/signatures.ts index 031922b..665a773 100644 --- a/packages/bumpgen-core/src/services/language/typescript/signatures.ts +++ b/packages/bumpgen-core/src/services/language/typescript/signatures.ts @@ -102,17 +102,8 @@ const indexSignatureDeclarationSignature = ( }; const functionDeclarationSignature = (node: FunctionDeclaration) => { - // ref: https://github.com/dsherret/ts-morph/issues/907 - const params = node - .getParameters() - .map((parameter) => parameter.getText()) - .join(", "); - const returnType = node.getReturnType().getText( - node, - // https://github.com/dsherret/ts-morph/issues/453#issuecomment-667578386 - TypeFormatFlags.UseAliasDefinedOutsideCurrentScope, - ); - return enrichWithTypeReferences(`(${params}) => ${returnType}`, node); + const typeDef = node.getText(); + return enrichWithTypeReferences(typeDef, node); }; const variableDeclarationSignature = (node: VariableDeclaration) => { @@ -121,13 +112,8 @@ const variableDeclarationSignature = (node: VariableDeclaration) => { }; const methodDeclarationSignature = (node: MethodDeclaration) => { - // ref: https://github.com/dsherret/ts-morph/issues/907 - const params = node - .getParameters() - .map((parameter) => parameter.getText()) - .join(", "); - const returnType = node.getReturnType().getText(); - return enrichWithTypeReferences(`(${params}) => ${returnType}`, node); + const typeDef = node.getText(); + return enrichWithTypeReferences(typeDef, node); }; const heritageClauseSignature = (node: HeritageClause) => {