sc-api-types
v1.1.4
Published
This package includes response typings for the [Star Citizen Wiki API](https://docs.star-citizen.wiki/). Currently types are limited to Star Systems, Ships and their respective relations.
Downloads
2
Readme
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.