ts_rs

Export TypeScript declarations from Rust types using ts-rs derive macros.

3|Updated Jan 10, 2026
One-click install
npx skills add https://github.com/yankeeinlondon/rusty-biscuit --skill ts-rs
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ts_rs
Source: https://github.com/yankeeinlondon/rusty-biscuit/tree/main/.claude/skills/ts_rs
Command: npx skills add https://github.com/yankeeinlondon/rusty-biscuit --skill ts-rs

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

ts-rs enables generating TypeScript type declarations from Rust types using derive macros and export workflows, keeping frontend/backend DTOs in sync and CI-friendly.

Core Features & Use Cases

  • Generate TypeScript types from Rust DTOs with #[derive(TS)] and #[ts(...)] attributes.
  • Align serialization with serde for fields, renaming, and tagging strategies.
  • Support generics, enums, and feature flags (chrono/uuid/url/serde_json) for practical pipelines.
  • Integrate into CI by exporting to a central directory and updating frontend typings.

Quick Start

Add ts-rs to your project, derive TS on your exported types, and run cargo test to generate the TypeScript bindings in the configured export directory.

Frequently Asked Questions about ts_rs

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I generate TypeScript types from Rust structs for frontend DTOs?

You can generate TypeScript types from Rust structs by deriving the TS macro on your structs and running cargo test, which exports TypeScript declarations to your configured directory to sync frontend DTOs with backend types.

Does ts-rs work with serde serialization attributes like renaming and tagging?

Yes, ts-rs aligns TypeScript type generation with serde attributes, supporting field renaming and tagging strategies to ensure the exported frontend types match your backend serialization logic exactly.

Can I export Rust enums and generic types to TypeScript declarations?

Yes, ts-rs supports exporting both Rust enums and generic types to TypeScript declarations, allowing you to share complex domain models directly with your frontend application across your monorepo.

What feature flags do I need for exporting Rust types with chrono, uuid, or serde_json?

You need to enable the specific feature flags for chrono, uuid, url, or serde_json in your ts-rs dependency configuration to correctly export TypeScript declarations for types using those crates.

How do I integrate Rust to TypeScript type generation into a CI pipeline?

Integrate type generation into CI by configuring the TS_RS_EXPORT_DIR environment variable, running cargo test to export up-to-date TypeScript bindings, and committing the generated files to your frontend monorepo.

What are the limitations of deriving TS for sharing types with TypeScript?

When deriving TS to share types, you must manually configure feature flags for external crates and set the export directory, requiring active maintenance of bindings rather than fully automated runtime synchronization.