sc-api-types
TypeScript icon, indicating that this package has built-in type declarations

1.1.4 • Public • Published

sc-api-types

This package includes response typings for the Star Citizen Wiki API. Currently types are limited to Star Systems, Ships and their respective relations.

Installation

npm: npm install --save-dev sc-api-types

yarn: yarn add --dev sc-api-types

Usage

Include Relationships

You can include the objects relationships by passing instruction to the generic response type, like this:

import { ShipResponse } from 'sc-api-types';

// now intersects with { components: { data: ShipComponent[] } }
type ShipWithComponentsResponse = ShipResponse<{ components: true }>;

Correct Locale Typing

If you're using the APIs locale parameter you'll want the response types to reflect the correct description property type. You can tell the response type that you're using the locale parameter like this:

import { ShipResponse } from 'sc-api-types';

// now descriptions are of type string instead of the locales object
type ShipWithStringDescs = ShipResponse<{}, 'en_EN'>;

Issues

If you're facing issues with these typings please do not hesistate to create an issue or pull request.

Dependencies (0)

    Dev Dependencies (2)

    Package Sidebar

    Install

    npm i sc-api-types

    Weekly Downloads

    1

    Version

    1.1.4

    License

    MIT

    Unpacked Size

    13.3 kB

    Total Files

    11

    Last publish

    Collaborators

    • kldzj