Skip to content

Commit

Permalink
fix(app): union type and literaltypenode
Browse files Browse the repository at this point in the history
  • Loading branch information
vogloblinsky committed Jul 14, 2021
1 parent 4a6ad03 commit 162ea28
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
15 changes: 12 additions & 3 deletions src/app/compiler/angular/deps/helpers/class-helper.ts
Expand Up @@ -840,9 +840,14 @@ export class ClassHelper {
_return += _firstPart + kindToType(type.kind);
}
} else {
_return += kindToType(type.kind);
if (ts.isLiteralTypeNode(type) && type.literal) {
_return += '"' + type.literal.text + '"';
if (type.literal.text) {
_return += '"' + type.literal.text + '"';
} else {
_return += kindToType(type.literal.kind);
}
} else {
_return += kindToType(type.kind);
}
if (type.typeName) {
_return += this.visitTypeName(type.typeName);
Expand Down Expand Up @@ -878,7 +883,11 @@ export class ClassHelper {
_return += kindToType(type.kind);
}
if (ts.isLiteralTypeNode(type) && type.literal) {
_return += '"' + type.literal.text + '"';
if (type.literal.text) {
_return += '"' + type.literal.text + '"';
} else {
_return += kindToType(type.literal.kind);
}
}
if (type.typeName) {
_return += this.visitTypeName(type.typeName);
Expand Down
3 changes: 0 additions & 3 deletions src/utils/kind-to-type.ts
Expand Up @@ -24,9 +24,6 @@ export function kindToType(kind: number): string {
case SyntaxKind.TemplateLiteralType:
_type = 'template literal type';
break;
case SyntaxKind.TypeReference:
_type = 'type reference';
break;
case SyntaxKind.TypeLiteral:
_type = 'literal type';
break;
Expand Down

0 comments on commit 162ea28

Please sign in to comment.