Skip to content

Commit

Permalink
fix(eslint-plugin): fix printing BigInt literal
Browse files Browse the repository at this point in the history
  • Loading branch information
sosukesuzuki committed Mar 5, 2023
1 parent d022d8e commit c9be94f
Showing 1 changed file with 7 additions and 1 deletion.
Expand Up @@ -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)) {
Expand Down

0 comments on commit c9be94f

Please sign in to comment.