File tree Expand file tree Collapse file tree 2 files changed +29
-4
lines changed
Expand file tree Collapse file tree 2 files changed +29
-4
lines changed Original file line number Diff line number Diff line change @@ -13720,14 +13720,24 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
1372013720 && isTypeUsableAsIndexSignature(isComputedPropertyName(node) ? checkComputedPropertyName(node) : checkExpressionCached((node as ElementAccessExpression).argumentExpression));
1372113721 }
1372213722
13723- function isLateBindableAST(node: DeclarationName) {
13724- if (!isComputedPropertyName(node) && !isElementAccessExpression(node)) {
13725- return false;
13723+ function isLateBindableExpression(expr: Expression): boolean {
13724+ while (isElementAccessExpression(expr)) {
13725+ if (!isStringOrNumericLiteralLike(expr.argumentExpression)) return false;
13726+ expr = expr.expression;
1372613727 }
13727- const expr = isComputedPropertyName(node) ? node.expression : node.argumentExpression;
1372813728 return isEntityNameExpression(expr);
1372913729 }
1373013730
13731+ function isLateBindableAST(node: DeclarationName) {
13732+ if (isComputedPropertyName(node)) {
13733+ return isLateBindableExpression(node.expression);
13734+ }
13735+ else if (isElementAccessExpression(node)) {
13736+ return isLateBindableExpression(node.argumentExpression);
13737+ }
13738+ return false;
13739+ }
13740+
1373113741 function isTypeUsableAsIndexSignature(type: Type): boolean {
1373213742 return isTypeAssignableTo(type, stringNumberSymbolType);
1373313743 }
Original file line number Diff line number Diff line change 1+
2+ enum Type {
3+ Foo = 'foo' ,
4+ '3x14' = '3x14'
5+ }
6+
7+ type TypeMap = {
8+ [ Type . Foo ] : 1 ;
9+ [ Type [ '3x14' ] ] : 2 ;
10+ }
11+
12+ const t : TypeMap = {
13+ 'foo' : 1 ,
14+ '3x14' : 2
15+ } ;
You can’t perform that action at this time.
0 commit comments