mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-10 18:04:18 -05:00
Fixed a crash in getPropertyNameForPropertyNameNode on NoSubstitutionTemplateLiteral (#55930)
This commit is contained in:
committed by
GitHub
parent
13a2150e8e
commit
d9cd2d0bd0
@@ -17727,7 +17727,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
|
||||
return false;
|
||||
}
|
||||
|
||||
function getPropertyNameFromIndex(indexType: Type, accessNode: StringLiteral | Identifier | PrivateIdentifier | ObjectBindingPattern | ArrayBindingPattern | ComputedPropertyName | NumericLiteral | IndexedAccessTypeNode | ElementAccessExpression | SyntheticExpression | undefined) {
|
||||
function getPropertyNameFromIndex(indexType: Type, accessNode: PropertyName | ObjectBindingPattern | ArrayBindingPattern | IndexedAccessTypeNode | ElementAccessExpression | SyntheticExpression | undefined) {
|
||||
return isTypeUsableAsPropertyName(indexType) ?
|
||||
getPropertyNameFromType(indexType) :
|
||||
accessNode && isPropertyName(accessNode) ?
|
||||
|
||||
@@ -1692,7 +1692,7 @@ export interface QualifiedName extends Node, FlowContainer {
|
||||
|
||||
export type EntityName = Identifier | QualifiedName;
|
||||
|
||||
export type PropertyName = Identifier | StringLiteral | NumericLiteral | ComputedPropertyName | PrivateIdentifier;
|
||||
export type PropertyName = Identifier | StringLiteral | NoSubstitutionTemplateLiteral | NumericLiteral | ComputedPropertyName | PrivateIdentifier;
|
||||
|
||||
export type MemberName = Identifier | PrivateIdentifier;
|
||||
|
||||
|
||||
@@ -5062,6 +5062,7 @@ export function getPropertyNameForPropertyNameNode(name: PropertyName | JsxAttri
|
||||
case SyntaxKind.PrivateIdentifier:
|
||||
return name.escapedText;
|
||||
case SyntaxKind.StringLiteral:
|
||||
case SyntaxKind.NoSubstitutionTemplateLiteral:
|
||||
case SyntaxKind.NumericLiteral:
|
||||
return escapeLeadingUnderscores(name.text);
|
||||
case SyntaxKind.ComputedPropertyName:
|
||||
|
||||
Reference in New Issue
Block a user