Skip to content

Commit

Permalink
feat: format type converter
Browse files Browse the repository at this point in the history
  • Loading branch information
ariansobczak-rst committed Jan 18, 2022
1 parent ce290e9 commit 8f19ed7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions typescript/type-converter.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,12 +147,12 @@ module.exports = function typeConverter(src, filename = 'test.ts') {
if (jsDocNode) {
let comment = src.substring(jsDocNode.pos, jsDocNode.end)
const name = getName(statement, src)

if (ts.isTypeAliasDeclaration(statement)) {
if (ts.isFunctionTypeNode(statement.type)) {
comment = appendComment(comment, `@typedef {function} ${name}`)
return convertParams(comment, statement, src)
}
}
if (ts.isTypeLiteralNode(statement.type)) {
comment = appendComment(comment, `@typedef {object} ${name}`)
return convertMembers(comment, statement.type, src)
Expand Down

0 comments on commit 8f19ed7

Please sign in to comment.