apollo-type-bigint-fix
TypeScript icon, indicating that this package has built-in type declarations

0.1.2 • Public • Published

apollo-type-bigint

BigInt integer type for Apollo server. This package provides 2 implementation options for working with large integers.

First implementation


This implementation allows working with only 53 bit integers. To work in the 53-bit number mode, you need to create an instance of the GraphQLBigInt class and pass the string "safe" to the constructor.

Example

import { makeExecutableSchema } from "graphql-tools";
import BigInt from "apollo-type-bigint";

const typeDefs = `
scalar BigInt

type Query {
  Test: BigInt
}
`;

const resolvers = {
	BigInt: new BigInt("safe")
};

export default makeExecutableSchema({ typeDefs, resolvers });

Second implementation


The second implementation allows you to work with 63 bit integers using a new data type in JavaScript - BigInt. To work in this mode, you need to create an instance of the GraphQLBigInt class and pass the "bigInt" to the constructor for the term.

Example

import { makeExecutableSchema } from "graphql-tools";
import BigInt from "apollo-type-bigint";

const typeDefs = `
scalar BigInt

type Query {
  Test: BigInt
}
`;

const resolvers = {
	BigInt: new BigInt("bigInt")
};

export default makeExecutableSchema({ typeDefs, resolvers });

Package Sidebar

Install

npm i apollo-type-bigint-fix

Weekly Downloads

4

Version

0.1.2

License

MIT

Unpacked Size

7.1 kB

Total Files

5

Last publish

Collaborators

  • casted_josh
  • casted_dev