File tree Expand file tree Collapse file tree 3 files changed +5
-121
lines changed
tests/baselines/reference Expand file tree Collapse file tree 3 files changed +5
-121
lines changed Original file line number Diff line number Diff line change @@ -8151,6 +8151,9 @@ namespace ts {
81518151 }
81528152 return indexInfo.type;
81538153 }
8154+ if (indexType.flags & TypeFlags.Never) {
8155+ return neverType;
8156+ }
81548157 if (accessExpression && !isConstEnumObjectType(objectType)) {
81558158 if (noImplicitAny && !compilerOptions.suppressImplicitAnyIndexErrors) {
81568159 if (getIndexTypeOfType(objectType, IndexKind.Number)) {
@@ -8163,9 +8166,6 @@ namespace ts {
81638166 return anyType;
81648167 }
81658168 }
8166- if (indexType.flags & TypeFlags.Never) {
8167- return neverType;
8168- }
81698169 if (accessNode) {
81708170 const indexNode = accessNode.kind === SyntaxKind.ElementAccessExpression ? accessNode.argumentExpression : accessNode.indexType;
81718171 if (indexType.flags & (TypeFlags.StringLiteral | TypeFlags.NumberLiteral)) {
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -117,8 +117,8 @@ declare const key: never
117117>key : never
118118
119119const result6 = obj[key]
120- >result6 : any
121- >obj[key] : any
120+ >result6 : never
121+ >obj[key] : never
122122>obj : { a: string; b: number; }
123123>key : never
124124
You can’t perform that action at this time.
0 commit comments