@irsdk-node/types
v4.0.5
Published
_Types implemented for **iRacing SDK v1.19**. You can see the latest version of the SDK [on the forums](https://forums.iracing.com/discussion/62/iracing-sdk/p1)._
Readme
@irsdk-node/types
Types implemented for iRacing SDK v1.19. You can see the latest version of the SDK on the forums.
This package provides TypeScript type definitions and enums that match the data structures and API's of the iRacing SDK, as well as a generated list of telemetry variables available from the SDK.
If you are using irsdk-node, you do not need to import this package directly as it gets re-exported via irsdk-node.
Usage
Install as a dependency. If you are not using the enums, you can save it as a dev dependency.
# Via npm..
$ npm install @irsdk-node/types
# Or yarn..
$ yarn add @irsdk-node/types
# Or pnpm..
$ pnpm add @irsdk-node/typesThen import whatever type or enum that you need.
import { Sector } from '@irsdk-node/types';
const sectors: Sector = { ... };Contributing
Commands
# Install dependencies
$ pnpm i
# Build the types
$ pnpm build
# Watch types, re-compiling on changes
$ pnpm watch
# Clean the build directories
$ pnpm clean
# Lint package
$ pnpm lintGenerating types
Many of the interfaces and enums are hand-converted from the C++ enums SDK defines module. You can find these by looking in the irsdk_defines.h file of @irsdk-node/native.
The telemetry data cannot be converted manually without losing your sanity, so a script has been written to do this automatically. You can run this by joining a session on iRacing, enter the car, and then opening up a terminal to the irsdk-node package and running the following command:
$ pnpm types:generateAlternatively, you can run the type generation function from anywhere in the repo via:
$ pnpm run -w types:generateAs the telemetry can be different on a per-car basis, this will take the telemetry variables active in your session and compare them against a cache to determine if there are any new types detected. If some are detected, the typescript file will be updated.
There might be some missing types since this is car-specific. While all base cars have been checked, and most categories of road cars, there may be still be some missing variables. If you cannot find a variable for a car you are using, please run this command against the car to get them added, then create a PR!
Please see the responses to this forum post for more information.
