Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

graphql-language-service-types

Package Overview
Dependencies
Maintainers
13
Versions
62
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

graphql-language-service-types

Types for building GraphQL language services for IDEs

  • 1.8.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
93K
decreased by-11.34%
Maintainers
13
Weekly downloads
 
Created

What is graphql-language-service-types?

The graphql-language-service-types package provides TypeScript types for GraphQL language services. It is designed to support the development of tools and services that work with GraphQL, such as editors, IDEs, and other development tools. The package includes types for various GraphQL language constructs, diagnostics, and more.

What are graphql-language-service-types's main functionalities?

GraphQL Language Constructs

This feature allows you to define GraphQL schemas using the provided types. The code sample demonstrates how to create a simple schema with a single query field.

import { GraphQLSchema, GraphQLObjectType, GraphQLString } from 'graphql-language-service-types';

const schema = new GraphQLSchema({
  query: new GraphQLObjectType({
    name: 'RootQueryType',
    fields: {
      hello: {
        type: GraphQLString,
        resolve() {
          return 'Hello world!';
        }
      }
    }
  })
});

Diagnostics

This feature provides types for diagnostics, which can be used to report errors and warnings in GraphQL documents. The code sample shows how to create a diagnostic object for a syntax error.

import { Diagnostic, DiagnosticSeverity } from 'graphql-language-service-types';

const diagnostic: Diagnostic = {
  range: {
    start: { line: 0, character: 0 },
    end: { line: 0, character: 5 }
  },
  message: 'Syntax error',
  severity: DiagnosticSeverity.Error
};

Completion Items

This feature provides types for completion items, which can be used to offer code completion suggestions in GraphQL documents. The code sample demonstrates how to create a completion item for a query field.

import { CompletionItem, CompletionItemKind } from 'graphql-language-service-types';

const completionItem: CompletionItem = {
  label: 'Query',
  kind: CompletionItemKind.Field,
  data: 'query'
};

Other packages similar to graphql-language-service-types

Keywords

FAQs

Package last updated on 09 Nov 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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc