Skip to content

Commit cd312d3

Browse files
committedAug 31, 2022
Managing control flow
1 parent 9b1cbe0 commit cd312d3

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed
 

‎src/compiler/checker.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -15589,12 +15589,13 @@ m2: ${(this.mapper2 as unknown as DebugTypeMapper).__debugToString().split("\n")
1558915589
return accessFlags & AccessFlags.IncludeUndefined ? getUnionType([indexInfo.type, undefinedType]) : indexInfo.type;
1559015590
}
1559115591
errorIfWritingToReadonlyIndex(indexInfo);
15592-
if (accessFlags & AccessFlags.IncludeUndefined && objectType.symbol && objectType.symbol.flags & (SymbolFlags.RegularEnum | SymbolFlags.ConstEnum)) {
15593-
if (indexType.symbol && indexType.flags & TypeFlags.EnumLiteral && getParentOfSymbol(indexType.symbol) === objectType.symbol) {
15592+
if (accessFlags & AccessFlags.IncludeUndefined) {
15593+
if (objectType.symbol && objectType.symbol.flags & (SymbolFlags.RegularEnum | SymbolFlags.ConstEnum) && (indexType.symbol && indexType.flags & TypeFlags.EnumLiteral && getParentOfSymbol(indexType.symbol) === objectType.symbol)) {
1559415594
return indexInfo.type;
1559515595
}
15596+
return getUnionType([indexInfo.type, undefinedType]);
1559615597
}
15597-
return accessFlags & AccessFlags.IncludeUndefined ? getUnionType([indexInfo.type, undefinedType]) : indexInfo.type;
15598+
return indexInfo.type;
1559815599
}
1559915600
if (indexType.flags & TypeFlags.Never) {
1560015601
return neverType;

0 commit comments

Comments
 (0)
Please sign in to comment.