Correct 'BigInt' types to 'bigint' (and add Typescript checking script) #84
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
First off, fantastic work on this project! The recent addition of Typescript types is a massive feature, especially for such a complex and unorthodox (in JS) API.
I noticed one small glitch in them when introducing the latest version to my private project, where I had already begun using an older, less comprehensive type declaration and my own

bigint
types. The glitch is thatBigInt
types are used, but they should bebigint
instead. It's a very confusing situation, but the PascalCased 'object types' for primitive values are actually just the type of the constructor function for the boxed object versions of the primitives. It's usually a mistake to use those as the type of the values themselves, and it can cause issues in usage, the main one being thatBigInt
andbigint
are not assignable to each other (which makes sense, one is a number and one is a constructor function):Some sources that explain this in some more detail:
This changeset fixes those types, and it also adds Typescript as a dev dependency, as well as a barebones tsconfig.json and a package.json script to run it and type-check index.d.ts. It wasn't failing before this change, but it's nice to have to make sure type changes don't introduce an internal error.