Skip to content

Commit

Permalink
Resolve signatures when printing type in console
Browse files Browse the repository at this point in the history
  • Loading branch information
blakeembrey committed Oct 14, 2019
1 parent 660bcf8 commit e8b53df
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -418,8 +418,11 @@ export function register (opts: Options = {}): Register {

if (!symbol) return { name: '', comment: '' }

const type = checker.getTypeOfSymbolAtLocation(symbol, node)
const signatures = [...type.getConstructSignatures(), ...type.getCallSignatures()]

return {
name: checker.typeToString(checker.getTypeOfSymbolAtLocation(symbol, node)),
name: signatures.length ? signatures.map(x => checker.signatureToString(x)).join('\n') : checker.typeToString(type),
comment: ts.displayPartsToString(symbol ? symbol.getDocumentationComment(checker) : [])
}
}
Expand Down

0 comments on commit e8b53df

Please sign in to comment.