Skip to content

Commit

Permalink
Merge branch 'master' into predict-ts-functions-types
Browse files Browse the repository at this point in the history
  • Loading branch information
ariansobczak-rst committed Jan 21, 2022
2 parents 91ea5d8 + 9ecab03 commit 4ddba31
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
notify:
name: Notify
runs-on: ubuntu-latest
if: always()
if: failure()
needs:
- test
- setup
Expand Down
29 changes: 14 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,20 @@
},
"author": "Wojciech Krysiak",
"license": "MIT",
"dependencies": {
"brace": "^0.11.1",
"react-ace": "^9.5.0",
"react-docgen": "^5.4.0",
"react-frame-component": "^5.2.1",
"typescript": "^4.5.4",
"underscore": "^1.13.2",
"vue-docgen-api": "^3.26.0",
"vue2-ace-editor": "^0.0.15"
},
"peerDependencies": {
"react": "^17.0.2",
"react-dom": "^17.0.2"
},
"devDependencies": {
"@babel/cli": "^7.16.8",
"@babel/core": "^7.16.7",
Expand Down Expand Up @@ -45,21 +59,6 @@
"sass": "^1.48.0",
"semantic-release": "^18.0.1"
},
"peerDependencies": {
"react": "^17.0.2",
"react-dom": "^17.0.2",
"typescript": "^4.5.4"
},
"dependencies": {
"brace": "^0.11.1",
"react-ace": "^9.5.0",
"react-docgen": "^5.4.0",
"react-frame-component": "^5.2.1",
"typescript": "^4.5.4",
"underscore": "^1.13.2",
"vue-docgen-api": "^3.26.0",
"vue2-ace-editor": "^0.0.15"
},
"husky": {
"hooks": {
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
Expand Down
25 changes: 25 additions & 0 deletions typescript/type-converter.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,31 @@ const fillMethodComment = (comment, member, src) => {
return comment
}

/**
* Fill missing method declaration
*
* @param {string} comment
* @param member
* @param {string} src
* @return {string}
*/
const fillMethodComment = (comment, member, src) => {
if (!comment.includes('@method')) {
comment = appendComment(comment, '@method')
}
if (!comment.includes('@param')) {
comment = convertParams(comment, member, src)
}
if (ts.isArrayTypeNode(member.type)) {
comment = convertMembers(comment, member.type, src)
}
if (!comment.includes('@return')) {
const returnType = getTypeName(member.type, src)
comment = appendComment(comment, `@return {${returnType}}`)
}
return comment
}

/**
* converts function parameters to @params
*
Expand Down

0 comments on commit 4ddba31

Please sign in to comment.