Skip to content

Commit

Permalink
fix type defs (#30)
Browse files Browse the repository at this point in the history
Signed-off-by: Benji Visser <[email protected]>
  • Loading branch information
noqcks authored Apr 25, 2024
1 parent 1765153 commit 6f2c0d3
Showing 1 changed file with 4 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand All @@ -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) => {
Expand Down

0 comments on commit 6f2c0d3

Please sign in to comment.