Skip to content

Commit

Permalink
chore(gatsby): Migrate schema-composer.js to TS (#31998)
Browse files Browse the repository at this point in the history
  • Loading branch information
alisson-suzigan authored Jun 29, 2021
1 parent a82f6db commit 8837033
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 22 deletions.
22 changes: 0 additions & 22 deletions packages/gatsby/src/schema/schema-composer.js

This file was deleted.

22 changes: 22 additions & 0 deletions packages/gatsby/src/schema/schema-composer.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { SchemaComposer, GraphQLJSON } from "graphql-compose"
import { addDirectives, GraphQLFieldExtensionDefinition } from "./extensions"
import { GraphQLDate } from "./types/date"
import { IGatsbyResolverContext } from "./type-definitions"
import { getNodeInterface } from "./types/node-interface"

export const createSchemaComposer = <TSource, TArgs>({
fieldExtensions,
}: GraphQLFieldExtensionDefinition = {}): SchemaComposer<
IGatsbyResolverContext<TSource, TArgs>
> => {
const schemaComposer: SchemaComposer<IGatsbyResolverContext<
TSource,
TArgs
>> = new SchemaComposer()

getNodeInterface({ schemaComposer })
schemaComposer.add(GraphQLDate)
schemaComposer.add(GraphQLJSON)
addDirectives({ schemaComposer, fieldExtensions })
return schemaComposer
}

0 comments on commit 8837033

Please sign in to comment.