
Product
Introducing Historical Analytics – Now in Beta
We’re excited to announce a powerful new capability in Socket: historical data and enhanced analytics.
graphql-type-bigint
Advanced tools
GraphQLInt
.The GraphQL spec limits its Int
type to 32-bits. Maybe you've seen this error before:
GraphQLError: Argument "num" has invalid value 9007199254740990.
Expected type "Int", found 9007199254740990.
Why? 64-bits would be too large for JavaScript's 53-bit limit. According to Lee Byron, a 52-bit integer spec would have been "too weird" see this issue. The spec therefore has 32-bit integers to ensure portability to languages that can't represent 64-bit integers. However, if you don't care about that, and you just want to use JavaScript's special 53-bit integers, you can use this scalar type instead!
$ npm install graphql-type-bigint
Use it the same as any other scalar type, either input or output.
const Bigint = require('graphql-type-bigint');
const SomeType = new GraphQLObjectType({
name: 'SomeType',
fields: {
numberField: {
type: Bigint,
// this would throw an error with the GraphQLInt
resolve: () => Number.MAX_SAFE_INTEGER,
},
},
});
FAQs
Bigint scalar type for GraphQL.js
The npm package graphql-type-bigint receives a total of 2,274 weekly downloads. As such, graphql-type-bigint popularity was classified as popular.
We found that graphql-type-bigint demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
We’re excited to announce a powerful new capability in Socket: historical data and enhanced analytics.
Product
Module Reachability filters out unreachable CVEs so you can focus on vulnerabilities that actually matter to your application.
Company News
Socket is bringing best-in-class reachability analysis into the platform — cutting false positives, accelerating triage, and cementing our place as the leader in software supply chain security.