mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
fix(56562): Type with negative properties cause crash in infer return type (#56565)
This commit is contained in:
@@ -8345,7 +8345,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
|
||||
return factory.createStringLiteral(name, !!singleQuote);
|
||||
}
|
||||
if (isNumericLiteralName(name) && startsWith(name, "-")) {
|
||||
return factory.createComputedPropertyName(factory.createNumericLiteral(+name));
|
||||
return factory.createComputedPropertyName(factory.createPrefixUnaryExpression(SyntaxKind.MinusToken, factory.createNumericLiteral(-name)));
|
||||
}
|
||||
return createPropertyNameNodeForIdentifierOrLiteral(name, getEmitScriptTarget(compilerOptions), singleQuote, stringNamed, isMethod);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user