Skip to content

Commit

Permalink
Managing control flow
Browse files Browse the repository at this point in the history
  • Loading branch information
navya9singh committed Aug 31, 2022
1 parent 9b1cbe0 commit cd312d3
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/compiler/checker.ts
Expand Up @@ -15589,12 +15589,13 @@ m2: ${(this.mapper2 as unknown as DebugTypeMapper).__debugToString().split("\n")
return accessFlags & AccessFlags.IncludeUndefined ? getUnionType([indexInfo.type, undefinedType]) : indexInfo.type;
}
errorIfWritingToReadonlyIndex(indexInfo);
if (accessFlags & AccessFlags.IncludeUndefined && objectType.symbol && objectType.symbol.flags & (SymbolFlags.RegularEnum | SymbolFlags.ConstEnum)) {
if (indexType.symbol && indexType.flags & TypeFlags.EnumLiteral && getParentOfSymbol(indexType.symbol) === objectType.symbol) {
if (accessFlags & AccessFlags.IncludeUndefined) {
if (objectType.symbol && objectType.symbol.flags & (SymbolFlags.RegularEnum | SymbolFlags.ConstEnum) && (indexType.symbol && indexType.flags & TypeFlags.EnumLiteral && getParentOfSymbol(indexType.symbol) === objectType.symbol)) {
return indexInfo.type;
}
return getUnionType([indexInfo.type, undefinedType]);
}
return accessFlags & AccessFlags.IncludeUndefined ? getUnionType([indexInfo.type, undefinedType]) : indexInfo.type;
return indexInfo.type;
}
if (indexType.flags & TypeFlags.Never) {
return neverType;
Expand Down

0 comments on commit cd312d3

Please sign in to comment.