Skip to content

Commit

Permalink
Don't use BigInt (sindresorhus#412)
Browse files Browse the repository at this point in the history
  • Loading branch information
frontsideair authored and skarab42 committed Aug 24, 2022
1 parent fc22db0 commit 8848578
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion source/jsonify.d.ts
Expand Up @@ -66,7 +66,7 @@ type Jsonify<T> =
// Check if there are any non-JSONable types represented in the union.
// Note: The use of tuples in this first condition side-steps distributive conditional types
// (see https://github.com/microsoft/TypeScript/issues/29368#issuecomment-453529532)
[Extract<T, NotJsonable | BigInt>] extends [never]
[Extract<T, NotJsonable | bigint>] extends [never]
? T extends PositiveInfinity | NegativeInfinity ? null
: T extends JsonPrimitive
? T // Primitive is acceptable
Expand Down
2 changes: 1 addition & 1 deletion test-d/jsonify.ts
Expand Up @@ -193,7 +193,7 @@ declare const tupleRestJson: Jsonify<[string, ...Date[]]>;
expectType<[string, ...string[]]>(tupleRestJson);

// BigInt fails JSON.stringify
declare const bigInt: Jsonify<BigInt>;
declare const bigInt: Jsonify<bigint>;
expectType<never>(bigInt);

declare const int8Array: Int8Array;
Expand Down

0 comments on commit 8848578

Please sign in to comment.