Correct 'BigInt' types to 'bigint' (and add Typescript checking script)#84
Merged
tomayac merged 2 commits intosqlite:mainfrom Sep 3, 2024
Merged
Correct 'BigInt' types to 'bigint' (and add Typescript checking script)#84tomayac merged 2 commits intosqlite:mainfrom
tomayac merged 2 commits intosqlite:mainfrom
Conversation
…eck-types' script to run Typescript and verify index.d.ts
Collaborator
For trivia's sake, an explanation of that aspect: non-vanilla JS has never been on our development radar in the upstream project, so the quirks of higher-level tools plays no role whatsoever in its shape. Our high-level APIs (namely the sqlite3.oo1 namespace) provide "a" solution which people can use if they like, while making no claim whatsoever about being "the" solution. We also provide very-close-to-C-native bindings from which more "downstream-idiomatic" solutions can be built, but we leave the creation of those to folks who live in that highly-fluid downstream ecosystem. We'd love to see other solutions evolve, but so far nobody has pulled on that thread. |
Collaborator
|
Released as 3.46.1-build3. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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

biginttypes. The glitch is thatBigInttypes are used, but they should bebigintinstead. 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 thatBigIntandbigintare 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.