Skip to content

Typescript type definitions for the Steam client, that automatically update

Notifications You must be signed in to change notification settings

BossSloth/SteamTypes

Repository files navigation

SteamTypes

Important

This project is not yet finished and is still in development. Expect major breaking changes if you decide to use it.

TypeScript type definitions for the Steam client window objects including SteamClient, UI components, and global objects.

Installation

bun add -d steam-types
# or
pnpm add -D steam-types

Usage

To override the global SteamClient type that may be provided by other packages like @steambrew/client, create a patch file and remove the global SteamClient type

Project Structure

This project consists of:

  1. Generated TypeScript definitions in the src/types folder
  2. Automation scripts in the scripts folder for generating and validating types see Development

Type Definitions

The type definitions cover the Steam client's global SharedJSContext window objects, including:

  • SteamClient object and all its submodules (Apps, UI, System, etc.)
  • All the other global objects (appDetailsStore, collectionStore, etc.)

Development

Scripts

The project includes scripts for:

  • Converting runtime JS objects to TypeScript interfaces
  • Comparing and validating the generated types against the actual Steam client
  • Automating the type generation process

Useful Commands for generating types

Fill a lot of data:

fillAppData();

map an app details value:

[...appDetailsStore.m_mapAppData.values()].map(data => {return {value: data.details?.eCloudSync, name: data.details?.strDisplayName}}).filter(d => d.value !== undefined)

Profile a script:

tsx --cpu-prof --cpu-prof-dir .profiler --no-warnings scripts/convert-to-typescript/test.ts

Type Validation

Run the type validation script to ensure definitions match the runtime objects:

bun validate-types

Contributing

Contributions are welcome! Please follow the existing naming conventions and ensure all generated interfaces are properly exported.

Special thanks

  • This decky pr for the initial SteamClient type definitions and the inspiration for this project.

About

Typescript type definitions for the Steam client, that automatically update

Topics

Resources

Stars

Watchers

Forks

Sponsor this project

Contributors 2

  •  
  •