mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-16 15:45:27 -05:00
Don't error on bigint literal used in type
This commit is contained in:
@@ -30471,13 +30471,17 @@ namespace ts {
|
||||
}
|
||||
|
||||
function checkGrammarBigIntLiteral(node: BigIntLiteral): boolean {
|
||||
if (languageVersion < ScriptTarget.ESNext) {
|
||||
if (grammarErrorOnNode(node, Diagnostics.BigInt_literals_are_not_available_when_targetting_lower_than_ESNext)) {
|
||||
return true;
|
||||
const literalType = isLiteralTypeNode(node.parent) ||
|
||||
isPrefixUnaryExpression(node.parent) && isLiteralTypeNode(node.parent.parent);
|
||||
if (!literalType) {
|
||||
if (languageVersion < ScriptTarget.ESNext) {
|
||||
if (grammarErrorOnNode(node, Diagnostics.BigInt_literals_are_not_available_when_targetting_lower_than_ESNext)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (!compilerOptions.experimentalBigInt) {
|
||||
return grammarErrorOnNode(node, Diagnostics.Experimental_support_for_BigInt_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalBigInt_option_to_remove_this_warning);
|
||||
}
|
||||
}
|
||||
if (!compilerOptions.experimentalBigInt) {
|
||||
return grammarErrorOnNode(node, Diagnostics.Experimental_support_for_BigInt_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalBigInt_option_to_remove_this_warning);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user