Skip to content

Commit

Permalink
Add typeArguments to ReferenceType#toString() (#396)
Browse files Browse the repository at this point in the history
  • Loading branch information
jiayihu authored and blakeembrey committed Feb 15, 2017
1 parent 75db29c commit 26fbd15
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/lib/models/types/reference.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,18 @@ export class ReferenceType extends Type

/**
* Return a string representation of this type.
* @example EventEmitter<any>
*/
toString() {
if (this.reflection) {
return this.reflection.name + (this.isArray ? '[]' : '');
} else {
return this.name + (this.isArray ? '[]' : '');
var name = this.reflection ? this.reflection.name : this.name;
var arraySuffix = this.isArray ? '[]' : '';
var typeArgs = '';
if (this.typeArguments) {
typeArgs += '<';
typeArgs += this.typeArguments.map(arg => arg.toString()).join(', ');
typeArgs += '>'
}

return name + typeArgs + arraySuffix;
}
}

0 comments on commit 26fbd15

Please sign in to comment.