Skip to content

Commit 587b3bc

Browse files
committed
fix: fix ts type
1 parent 419ed11 commit 587b3bc

File tree

3 files changed

+93
-94
lines changed

3 files changed

+93
-94
lines changed

lib/jsdoc/tag/type.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -240,18 +240,23 @@ function getTypeStrings(parsedType, isOutermostType) {
240240
*/
241241
function parseTypeExpression(tagInfo) {
242242
var parsedType;
243+
var typeExpression = tagInfo.typeExpression;
243244

244245
// don't try to parse empty type expressions
245-
if (!tagInfo.typeExpression) {
246+
if (!typeExpression) {
246247
return tagInfo;
247248
}
249+
if (typeExpression.indexOf('$ts:') === 0) {
250+
tagInfo.type = [typeExpression];
248251

252+
return tagInfo;
253+
}
249254
try {
250-
parsedType = catharsis.parse(tagInfo.typeExpression, {jsdoc: true});
255+
parsedType = catharsis.parse(typeExpression, {jsdoc: true});
251256
}
252257
catch (e) {
253258
// always re-throw so the caller has a chance to report which file was bad
254-
throw new Error( util.format('Invalid type expression "%s": %s', tagInfo.typeExpression,
259+
throw new Error( util.format('Invalid type expression "%s": %s', typeExpression,
255260
e.message) );
256261
}
257262

package-lock.json

Lines changed: 83 additions & 89 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@daybrush/jsdoc",
3-
"version": "0.3.8",
3+
"version": "0.3.9",
44
"description": "An API documentation generator for JavaScript and Typescript.",
55
"keywords": [
66
"documentation",
@@ -19,7 +19,7 @@
1919
"dependencies": {
2020
"@babel/parser": "^7.2.3",
2121
"@babel/types": "^7.2.2",
22-
"@daybrush/utils": "^0.4.0",
22+
"@daybrush/utils": "^1.0.0",
2323
"ast-parser": "0.0.5",
2424
"bluebird": "~3.5.0",
2525
"catharsis": "~0.8.9",

0 commit comments

Comments
 (0)