Skip to content

Commit 104b82f

Browse files
committed
fix(deps): support self-defined type
fix #267
1 parent c29204c commit 104b82f

File tree

5 files changed

+32
-0
lines changed

5 files changed

+32
-0
lines changed

dist/index-cli.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3578,6 +3578,11 @@ var Dependencies = /** @class */ (function () {
35783578
if (node.type.types[i].kind === ts$3.SyntaxKind.LiteralType && node.type.types[i].literal) {
35793579
_return += '"' + node.type.types[i].literal.text + '"';
35803580
}
3581+
if (typeof node.type.types[i].typeName !== 'undefined') {
3582+
if (typeof node.type.types[i].typeName.escapedText !== 'undefined') {
3583+
_return += node.type.types[i].typeName.escapedText;
3584+
}
3585+
}
35813586
if (i < len - 1) {
35823587
_return += ' | ';
35833588
}

dist/index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3578,6 +3578,11 @@ var Dependencies = /** @class */ (function () {
35783578
if (node.type.types[i].kind === ts$3.SyntaxKind.LiteralType && node.type.types[i].literal) {
35793579
_return += '"' + node.type.types[i].literal.text + '"';
35803580
}
3581+
if (typeof node.type.types[i].typeName !== 'undefined') {
3582+
if (typeof node.type.types[i].typeName.escapedText !== 'undefined') {
3583+
_return += node.type.types[i].typeName.escapedText;
3584+
}
3585+
}
35813586
if (i < len - 1) {
35823587
_return += ' | ';
35833588
}

src/app/compiler/dependencies.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1059,6 +1059,13 @@ export class Dependencies {
10591059
if (node.type.types[i].kind === ts.SyntaxKind.LiteralType && node.type.types[i].literal) {
10601060
_return += '"' + node.type.types[i].literal.text + '"';
10611061
}
1062+
1063+
if (typeof node.type.types[i].typeName !== 'undefined') {
1064+
if (typeof node.type.types[i].typeName.escapedText !== 'undefined') {
1065+
_return += node.type.types[i].typeName.escapedText;
1066+
}
1067+
}
1068+
10621069
if (i<len-1) {
10631070
_return += ' | ';
10641071
}

test/src/cli/cli-generation-big-app.spec.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,4 +260,11 @@ describe('CLI simple generation - big app', () => {
260260
expect(file).to.contain('../classes/Todo.html#completed');
261261
});
262262

263+
it('should support self-defined type', () => {
264+
let file = read('documentation/classes/Todo.html');
265+
expect(file).to.contain('../miscellaneous/typealiases.html#PopupPosition');
266+
file = read('documentation/miscellaneous/typealiases.html');
267+
expect(file).to.contain('<code>ElementRef | HTMLElement</code>');
268+
});
269+
263270
});

test/src/todomvc-ng2/src/app/shared/models/todo.model.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
import {
2+
ElementRef
3+
} from "@angular/core";
4+
15
import { Direction } from '../miscellaneous/miscellaneous';
26

37
export class Tada {
@@ -18,6 +22,8 @@ export class Todo extends Tada {
1822
*/
1923
editing: boolean;
2024

25+
pos?: PopupPosition;
26+
2127
[index: number]: string;
2228

2329
testCommentFunction(dig: number, str: string, bool: boolean): object {
@@ -65,3 +71,5 @@ export class Todo extends Tada {
6571
return 5;
6672
}
6773
}
74+
75+
export type PopupPosition = ElementRef | HTMLElement;

0 commit comments

Comments
 (0)