Skip to content

Typescript & GraphQL types for use when creating Nacelle products

License

Notifications You must be signed in to change notification settings

getnacelle/nacelle-types

Repository files navigation

@nacelle/types

TypeScript & GraphQL types for use with Nacelle products

Install

npm i @nacelle/types

Using the GraphQL Types

This package exports GraphQL type definitions which can be merged with type definitions in another project.

import { sharedTypeDefs } from '@nacelle/types';
import { mergeTypeDefs } from '@graphql-tools/merge';

import { typeDefs } from './src/your/type/defs';

const schema = makeExecutableSchema({
  typeDefs: mergeTypeDefs([sharedTypeDefs, typeDefs]),
  resolvers
});

Generating TypeScript Types

To generate TypeScript interfaces from the GraphQL type defintions, run npm run generate.

Using the TypeScript Types

import { NacelleProduct } from '@nacelle/types';

const product: NacelleProduct = { ... };

License

ISC © getnacelle