Skip to content

Commit d2bda47

Browse files
author
Arthur Ozga
committed
fix inTypeAlias logic
1 parent 1774c67 commit d2bda47

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/compiler/checker.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2297,7 +2297,6 @@ namespace ts {
22972297
InFirstTypeArgument: boolean; // Writing first type argument of the instantiated type
22982298
// TODO: ???
22992299
InTypeAlias: boolean; // Writing type in type alias declaration
2300-
checkAlias: boolean;
23012300
symbolStack: Symbol[] | undefined;
23022301
}
23032302

@@ -2310,7 +2309,6 @@ namespace ts {
23102309
InElementType: false,
23112310
InFirstTypeArgument: false,
23122311
InTypeAlias: false,
2313-
checkAlias: true,
23142312
symbolStack: undefined
23152313
};
23162314
}
@@ -2319,6 +2317,8 @@ namespace ts {
23192317
const InElementType = context.InElementType;
23202318
// TODO: why doesn't tts unset the flag?
23212319
context.InElementType = false;
2320+
const inTypeAlias = context.InTypeAlias;
2321+
context.InTypeAlias = false;
23222322

23232323
// TODO: should be assert?
23242324
if (!type) {
@@ -2406,12 +2406,11 @@ namespace ts {
24062406
return createTypeReferenceNode(name, /*typeArguments*/ undefined);
24072407
}
24082408

2409-
if (!context.InTypeAlias && context.checkAlias && type.aliasSymbol) {
2409+
if (!inTypeAlias && type.aliasSymbol) {
24102410
const name = symbolToName(type.aliasSymbol, /*expectsIdentifier*/ false, context);
24112411
const typeArgumentNodes = type.aliasTypeArguments && mapToTypeNodeArray(type.aliasTypeArguments, /*addInElementTypeFlag*/ false);
24122412
return createTypeReferenceNode(name, typeArgumentNodes);
24132413
}
2414-
context.checkAlias = false;
24152414

24162415
if (type.flags & (TypeFlags.Union | TypeFlags.Intersection)) {
24172416
const types = type.flags & TypeFlags.Union ? formatUnionTypes((<UnionType>type).types) : (<IntersectionType>type).types;

0 commit comments

Comments
 (0)