mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Fix BigInt literal error in ambient contexts when targeting < ES2020 (#61935)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: RyanCavanaugh <6685088+RyanCavanaugh@users.noreply.github.com>
This commit is contained in:
@@ -53188,7 +53188,8 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
|
||||
const literalType = isLiteralTypeNode(node.parent) ||
|
||||
isPrefixUnaryExpression(node.parent) && isLiteralTypeNode(node.parent.parent);
|
||||
if (!literalType) {
|
||||
if (languageVersion < ScriptTarget.ES2020) {
|
||||
// Don't error on BigInt literals in ambient contexts
|
||||
if (!(node.flags & NodeFlags.Ambient) && languageVersion < ScriptTarget.ES2020) {
|
||||
if (grammarErrorOnNode(node, Diagnostics.BigInt_literals_are_not_available_when_targeting_lower_than_ES2020)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user