Docs
RelayArgsInterface

RelayArgsInterface / Sink

Public types describing the configuration of CreateRelayEnvironment (RelayArgsInterface) and the Relay Observable sink (Sink).

RelayArgsInterface is the input contract of CreateRelayEnvironment: any change here is part of the package's public API. Sink is the minimal Observable interface that Relay exposes — used internally by the fetch/subscription handlers.

When to use

✅ Use when…🚫 Avoid when…
  • When you want to type the CreateRelayEnvironment config separately from the call (e.g. in a factory or in a constants module).
  • To annotate custom callbacks that receive a Sink (rare outside the internals).
  • If you are just calling new CreateRelayEnvironment({ ... }), TypeScript already infers the type from the constructor; importing RelayArgsInterface explicitly is redundant.

Example

import { CreateRelayEnvironment } from '@apollion-dsi/relay';
import { RelayArgsInterface } from '@apollion-dsi/relay/relayArgsInterface';
 
const baseConfig: RelayArgsInterface = {
  url: 'https://api.example.com/graphql/',
  useRetries: true,
  retries: [1000, 2000, 5000],
  usePersistedQueries: true, // send only build-time hashes (server allowlist)
};
 
const { Environment } = new CreateRelayEnvironment({
  ...baseConfig,
  useDebug: process.env.NODE_ENV !== 'production',
});

Granular imports

import { RelayArgsInterface, Sink } from '@apollion-dsi/relay/relayArgsInterface';
// or via the root barrel
import { RelayArgsInterface, Sink } from '@apollion-dsi/relay';

See also