stremio-types
v0.59.0
Published
Types generated from stremio-core
Downloads
256
Readme
stremio-types
TypeScript definitions for the stremio-core Rust project.
Auto-generated using ts-rs and various scripts.
Installation
Using Bun:
bun add stremio-typesUsing npm:
npm i stremio-typesUsage
Basic Types
import type { MetaItem } from "stremio-types";
const item: MetaItem = {
// Full autocompletion and type safety
};Type Guards and Constants
Every string union from the Rust core is transformed into a const array with an associated Type Guard.
import { ExtraTypes, isExtraType } from "stremio-types";
// Access the list of valid values
console.log(ExtraTypes);
// Validate an unknown string
const input = "search";
if (isExtraType(input)) {
// 'input' is now narrowed to ExtraType
console.log(`System is ${input}`);
}Development
Prerequisites
Setup
Clone the stremio-core repository and apply the patch:
bun run setupTo test against the latest stremio-core upstream tag:
bun run setup --latestBuilding
Generate types and build the package:
bun run buildThis will:
- Run cargo tests to export TypeScript bindings from stremio-core
- Process and clean up the generated types
- Build the distribution files
- Save any changes as a patch file
Automation
GitHub Actions can handle upstream syncs and publishing automatically.
.github/workflows/sync-upstream.ymlchecks for newstremio-core-web-v*tags on a schedule or manual dispatch.- When a new upstream release exists, it regenerates the types, updates
package.json, writes the new patch file, and commits the generated changes back tomain. .github/workflows/release.ymlhandles the tag creation and npm publish step, either from a direct manual version bump or after the sync workflow completes successfully.
License
See LICENSE
SPDX-License-Identifier: MIT