From c9be94f5ba3423437ff273fe4ec8a6376cfae77d Mon Sep 17 00:00:00 2001 From: Sosuke Suzuki Date: Sun, 5 Mar 2023 23:55:42 +0900 Subject: [PATCH] fix(eslint-plugin): fix printing BigInt literal --- .../src/rules/no-redundant-type-constituents.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/eslint-plugin/src/rules/no-redundant-type-constituents.ts b/packages/eslint-plugin/src/rules/no-redundant-type-constituents.ts index 33237a8ae4e2..2ba163487785 100644 --- a/packages/eslint-plugin/src/rules/no-redundant-type-constituents.ts +++ b/packages/eslint-plugin/src/rules/no-redundant-type-constituents.ts @@ -83,7 +83,13 @@ function describeLiteralType(type: ts.Type): string { } if (type.isLiteral()) { - return type.value.toString(); + if (typeof type.value === 'string' || typeof type.value === 'number') { + return type.value.toString(); + } + // type.valeus is ts.PseudoBigInt + return `${ + type.value.negative ? '-' : '' + }${type.value.base10Value.toString()}n`; } if (util.isTypeAnyType(type)) {