Skip to content

feat: type-safe .riv schema system#352

Open
mfazekas wants to merge 2 commits into
mainfrom
feat/type-safe-riv-schema-2
Open

feat: type-safe .riv schema system#352
mfazekas wants to merge 2 commits into
mainfrom
feat/type-safe-riv-schema-2

Conversation

@mfazekas

Copy link
Copy Markdown
Collaborator

Supersedes #294 (same feature, re-based onto main after the experimental-runtime merge in #134; squashed there since every commit conflicted with the runtime rewrite).

Codegen pipeline that extracts artboard/state machine/ViewModel schemas from .riv files and surfaces them as TypeScript phantom types — no runtime overhead. yarn rive-gen-types example/assets/rive/rewards.riv (or --all) emits a .riv.d.ts next to each asset; importing the asset then constrains artboardName/stateMachineName, viewModelName, property paths per kind, and enum value unions across RiveView, useRiveFile, useViewModelInstance, and the useRive* property hooks. See #294 for the full API walkthrough.

Changes relative to #294:

  1. Merged with the experimental-runtime changes: RiveFileFactory keeps getBackend(), the loadCdn deprecation warning and optional loadCdn? signatures, now with the typed generics on top; RiveView keeps the new docs/frameRate while its props are generic over the schema.
  2. Bumped @rive-app/canvas to 2.39.0 and regenerated all schemas — output is byte-identical, so the extractor works with the new runtime as is.
  3. Generated schemas for assets added on main since the branch (tabtest.riv, arbtboards-models-instances.riv).

Note: rive-wasm 2.39.0 now exposes ViewModelProperty.enumName, so the "enum names not accessible" limitation from #294 is gone — a follow-up can emit named enum types instead of inlined value unions.

mfazekas added 2 commits July 22, 2026 15:23
Squash of feat/type-safe-riv-schema (PR #294) re-merged onto main after the
experimental-runtime merge (#134).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant