# graphql-bigint

> A 53-bit wide implementation of integers for GraphQL

Latest version **1.0.0** (published 2017-07-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install graphql-bigint
pnpm add graphql-bigint
yarn add graphql-bigint
bun add graphql-bigint
```

## Health

**Score 23/100 (F)** — status: abandoned.

Positive: has types package; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2017-07-27 |
| First published | 2017-07-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/graphql-bigint) |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | acarl005 |
| Maintainers | acarl005 |
| Keywords | graphql, int, bigint, long, number |

## Links

- npm: https://www.npmjs.com/package/graphql-bigint
- Repository: https://github.com/stems/graphql-bigint
- Homepage: https://github.com/stems/graphql-bigint#readme
- Issues: https://github.com/stems/graphql-bigint/issues
- npm.io page: https://npm.io/package/graphql-bigint

## Alternatives

- [eslint-plugin-sonarjs](https://npm.io/package/eslint-plugin-sonarjs.md) — 2.9M weekly downloads
- [eslint-config-expo](https://npm.io/package/eslint-config-expo.md) — 1.5M weekly downloads
- [@matter/protocol](https://npm.io/package/@matter/protocol.md) — 63.5K weekly downloads
- [@eventcatalog/linter](https://npm.io/package/@eventcatalog/linter.md) — 24.8K weekly downloads
- [@inrupt/eslint-config-base](https://npm.io/package/@inrupt/eslint-config-base.md) — 4.5K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2017-07-27

## README

graphql-bigint
=============

A wider integer type for [graphql-js](https://github.com/graphql/graphql-js) than the default 32-bit `GraphQLInt`. This implementation gives you 53-bit integers.

## The problem

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](https://github.com/graphql/graphql-js/issues/292).

## Usage

```shell
$ npm install graphql-bigint
```

Use it the same as any other scalar type, either input or output.

```js
const BigInt = require('graphql-bigint')

const SomeType = new GraphQLObjectType({
  name: 'SomeType',
  fields: {
    numberField: {
      type: BigInt,
      // this would throw an error with the GraphQLInt
      resolve: () => Number.MAX_SAFE_INTEGER 
    }
  }
})
```

---
_Source: https://npm.io/package/graphql-bigint · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
