Skip to content

Commit 8aa2126

Browse files
committed
Fixed: Ensure that fields have been resolved when looking up js types in static target, see #731
1 parent e4a6b6f commit 8aa2126

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

cli/lib/tsd-jsdoc/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
protobuf.js fork of tsd-jsdoc
22
=============================
33

4-
This is a slightly modified and restructured version of [tsd-jsdoc](https://github.com/englercj/tsd-jsdoc) for use with protobuf.js, parked here so we can process issues and pull requests.
4+
This is a modified version of [tsd-jsdoc](https://github.com/englercj/tsd-jsdoc) v1.0.1 for use with protobuf.js, parked here so we can process issues and pull requests. The ultimate goal is to switch back to the a recent version of tsd-jsdoc once it meets our needs.
55

66
Options
77
-------

cli/targets/static.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ function toJsType(field) {
279279
type = "Uint8Array";
280280
break;
281281
default:
282-
if (field.resolvedType instanceof Enum)
282+
if (field.resolve().resolvedType instanceof Enum)
283283
type = field.resolvedType.fullName.substring(1); // reference the enum
284284
else if (field.resolvedType instanceof Type)
285285
type = field.resolvedType.fullName.substring(1) + "$Properties"; // reference the interface
@@ -302,10 +302,9 @@ function buildType(ref, type) {
302302
"@type {Object}"
303303
];
304304
type.fieldsArray.forEach(function(field) {
305-
var jsType = toJsType(field),
306-
prop = util.safeProp(field.name);
305+
var prop = util.safeProp(field.name);
307306
prop = prop.substring(1, prop.charAt(0) === "[" ? prop.length - 1 : prop.length);
308-
typeDef.push("@property {" + jsType + "} " + (field.optional ? "[" + prop + "]" : field.name) + " " + (field.comment || type.name + " " + field.name + "."));
307+
typeDef.push("@property {" + toJsType(field) + "} " + (field.optional ? "[" + prop + "]" : field.name) + " " + (field.comment || type.name + " " + field.name + "."));
309308
});
310309
push("");
311310
pushComment(typeDef);

0 commit comments

Comments
 (0)