IdioScalar
const { IdioScalar } = require("idio-graphql");
Intro
You can use IdioScalar to modularize a ScalarTypeDefinition
, together with its resolver.
You can only apply scalars 'top-level' at combineNodes.
IdioScalar does not require
typeDefs
, it uses the name to match up the resolver.
Example
Example uses graphql-type-json.
const JSONScalar = new IdioScalar({
name: "JSON",
resolver: GraphQLJSON
});
Definition
/**
* You can use IdioDirective to modularize a DirectiveDefinition,
* together with its resolver. You can only specify directives 'top-level'
* at combineNodes.
*/
class IdioScalar {
name: string;
typeDefs: string;
/** @type {GraphQLScalarType} */
resolver: any;
constructor(input: {
name: string;
/** @type {GraphQLScalarType} */ resolver: any;
});
}