Skip to content

Commit

Permalink
fix(app): tuple types
Browse files Browse the repository at this point in the history
  • Loading branch information
vogloblinsky committed Jul 14, 2021
1 parent 162ea28 commit d6d9955
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/app/compiler/angular-dependencies.ts
Expand Up @@ -625,7 +625,7 @@ export class AngularDependencies extends FrameworkDependencies {
if (node.type) {
typeAliasDeps.kind = node.type.kind;
if (typeAliasDeps.rawtype === '') {
typeAliasDeps.rawtype = kindToType(node.type.kind);
typeAliasDeps.rawtype = this.classHelper.visitType(node);
}
}

Expand Down
17 changes: 13 additions & 4 deletions src/app/compiler/angular/deps/helpers/class-helper.ts
Expand Up @@ -825,12 +825,12 @@ export class ClassHelper {
_return = '(' + _firstPart + ')' + kindToType(node.type.kind);
}
}
if (node.type.types && ts.isUnionTypeNode(node.type)) {
_return = '';

const parseTypesOrElements = arr => {
let i = 0;
let len = node.type.types.length;
let len = arr.length;
for (i; i < len; i++) {
let type = node.type.types[i];
let type = arr[i];

if (type.elementType) {
const _firstPart = this.visitType(type.elementType);
Expand Down Expand Up @@ -866,6 +866,15 @@ export class ClassHelper {
_return += ' | ';
}
}
};

if (node.type.elements && ts.isTupleTypeNode(node.type)) {
_return += '[';
parseTypesOrElements(node.type.elements);
_return += ']';
}
if (node.type.types && ts.isUnionTypeNode(node.type)) {
parseTypesOrElements(node.type.types);
}
if (node.type.elementTypes) {
let elementTypes = node.type.elementTypes;
Expand Down

0 comments on commit d6d9955

Please sign in to comment.