Skip to content

Commit 048fd20

Browse files
committed
fix(deps) : RangeError: Invalid array length / @input/@output parsing
fix #209
1 parent 7f17ecb commit 048fd20

File tree

3 files changed

+100
-36
lines changed

3 files changed

+100
-36
lines changed

dist/index-cli.js

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

dist/index.js

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

src/app/compiler/dependencies.ts

Lines changed: 34 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -857,12 +857,22 @@ export class Dependencies {
857857

858858
private visitInput(property, inDecorator, sourceFile?) {
859859
var inArgs = inDecorator.expression.arguments,
860-
_return = {
861-
name: inArgs.length ? inArgs[0].text : property.name.text,
862-
defaultValue: property.initializer ? this.stringifyDefaultValue(property.initializer) : undefined,
863-
description: marked(LinkParser.resolveLinks(ts.displayPartsToString(property.symbol.getDocumentationComment()))),
864-
line: this.getPosition(property, sourceFile).line + 1
865-
};
860+
_return = {};
861+
_return.name = (inArgs.length > 0) ? inArgs[0].text : property.name.text;
862+
_return.defaultValue = property.initializer ? this.stringifyDefaultValue(property.initializer) : undefined;
863+
if (property.symbol) {
864+
_return.description = marked(LinkParser.resolveLinks(ts.displayPartsToString(property.symbol.getDocumentationComment())))
865+
}
866+
if (!_return.description) {
867+
if (property.jsDoc) {
868+
if (property.jsDoc.length > 0) {
869+
if (typeof property.jsDoc[0].comment !== 'undefined') {
870+
_return.description = marked(property.jsDoc[0].comment);
871+
}
872+
}
873+
}
874+
}
875+
_return.line = this.getPosition(property, sourceFile).line + 1;
866876
if (property.type) {
867877
_return.type = this.visitType(property);
868878
} else {
@@ -931,12 +941,24 @@ export class Dependencies {
931941
}
932942

933943
private visitOutput(property, outDecorator, sourceFile?) {
934-
var outArgs = outDecorator.expression.arguments,
935-
_return = {
936-
name: outArgs.length ? outArgs[0].text : property.name.text,
937-
description: marked(LinkParser.resolveLinks(ts.displayPartsToString(property.symbol.getDocumentationComment()))),
938-
line: this.getPosition(property, sourceFile).line + 1
939-
};
944+
var inArgs = outDecorator.expression.arguments,
945+
_return = {};
946+
_return.name = (inArgs.length > 0) ? inArgs[0].text : property.name.text;
947+
_return.defaultValue = property.initializer ? this.stringifyDefaultValue(property.initializer) : undefined;
948+
if (property.symbol) {
949+
_return.description = marked(LinkParser.resolveLinks(ts.displayPartsToString(property.symbol.getDocumentationComment())))
950+
}
951+
if (!_return.description) {
952+
if (property.jsDoc) {
953+
if (property.jsDoc.length > 0) {
954+
if (typeof property.jsDoc[0].comment !== 'undefined') {
955+
_return.description = marked(property.jsDoc[0].comment);
956+
}
957+
}
958+
}
959+
}
960+
_return.line = this.getPosition(property, sourceFile).line + 1;
961+
940962
if (property.type) {
941963
_return.type = this.visitType(property);
942964
} else {

0 commit comments

Comments
 (0)