Relay Compiler TypeScript Language Plugin

15.0.1 · deprecated · verified Sun Apr 19

This package served as a language plugin for `relay-compiler`, providing TypeScript support, including the emission of type definitions for Relay artifacts. It enabled Relay users to leverage TypeScript for their GraphQL operations and component props. The current stable version is 15.0.1. Historically, it filled a critical gap by adding TypeScript capabilities to Relay's build process. However, as of Relay v13, TypeScript support is natively integrated into the core `relay-compiler`, rendering this standalone plugin obsolete. Its release cadence was tied to major Relay versions and bug fixes, but active development has ceased due to its superseded status. Developers are now advised to use the built-in TypeScript features of `relay-compiler` directly.

Common errors

Warnings

Install

Imports

Quickstart

Demonstrates the `package.json` setup for installing the plugin and `relay-compiler`, configuring the `relay` script, and essential `tsconfig.json` and `.babelrc` settings.

{
  "devDependencies": {
    "graphql": "^15.7.0",
    "relay-compiler": ">=12.0.0",
    "typescript": ">=4.5.0",
    "relay-compiler-language-typescript": "^15.0.0"
  },
  "scripts": {
    "relay": "relay-compiler --src ./src --schema data/schema.graphql --language typescript --artifactDirectory ./src/__generated__"
  }
}

// tsconfig.json
{
  "compilerOptions": {
    "module": "ES2015",
    "target": "ES2020"
  }
}

// .babelrc
{
  "plugins": [["relay", { "artifactDirectory": "./src/__generated__" }]]
}

view raw JSON →