New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@nacelle/types

Package Overview
Dependencies
Maintainers
15
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nacelle/types

Typescript & GraphQL types for use when creating Nacelle products

latest
Source
npmnpm
Version
5.0.4
Version published
Maintainers
15
Created
Source

@nacelle/types

TypeScript & GraphQL types for use with Nacelle products

Install

npm i @nacelle/types

Project Structure

In the src directory, there are two folders: custom & graphql. The graphql folder holds both the Graphql schema definitions and the TypeScript types generated from this schema. The GraphQL TypesScript types are programmatically generated from the type-defs file, so making any changes in the generated.ts file will only be overwritten when new types are created.

Types found in the custom directory are those that do not directly come from the GraphQL type definitions (i.e. data as it is stored in the DB, frontend-types, etc). These can extend the GraphQL types by importing from generated.ts.

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

FAQs

Package last updated on 25 Oct 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts