All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
- Complex Enum Variant Support: Full support for Rust enums with tuple and struct variants
- Simple enums (unit variants only) continue to generate TypeScript string literal unions /
z.enum() - Complex enums (tuple or struct variants) now generate TypeScript discriminated unions /
z.discriminatedUnion() - Variant payloads are fully typed, including nested structs and generics
- Enum variants are included in the AST cache for efficient subsequent runs
- Simple enums (unit variants only) continue to generate TypeScript string literal unions /
- Serde Attribute Parsing: Replaced regex-based parsing with
synAST functions- More robust and accurate handling of
#[serde(...)]attributes - Eliminates edge cases caused by pattern matching on raw token strings
- More robust and accurate handling of
- EventParser: Fixed bug where types were not discovered when moving emitter to external function
-
Smart Caching: Skip regeneration when source files haven't changed
- Creates
.typecachefile in output directory with hashes of discovered commands, types, and configuration - Compares hashes on subsequent runs to determine if regeneration is needed
- Significantly improves build times when nothing has changed
- Creates
-
Force Regeneration Flag: New option to bypass cache and force regeneration
- CLI:
--forceor-fflag (e.g.,cargo tauri-typegen generate --force) - Config:
"force": trueintauri.conf.jsonunderplugins.typegen - CLI flag takes priority over config file setting
- CLI:
-
Custom Type Mappings: Added support for mapping external Rust types to TypeScript types via configuration
- Configure in
tauri.conf.jsonunderplugins.typegen.typeMappings - Useful for external crate types like
DateTime<Utc>→stringorPathBuf→string - Example:
{ "plugins": { "typegen": { "typeMappings": { "DateTime<Utc>": "string", "PathBuf": "string" } } } }
- Configure in
-
CI Validation: Added GitHub Actions workflow to validate generated code compiles
- Automatically tests against examples repository on every commit
- Ensures generated TypeScript/Zod code has no compilation errors
- Updated outdated setup instructions
- BREAKING - TypeScript Type Mappings: Changed HashMap/BTreeMap generation from
Map<K,V>toRecord<K,V>HashMap<String, number>now generatesRecord<string, number>instead ofMap<string, number>- More idiomatic TypeScript that matches JSON serialization behavior
- Zod: Fixed bug where
z.coerce.number()was used for record/map declaration
- Generated files now contain a timestamp and tauri-typegen version info
- Added
--versionflag as CLI argument
- Generated zod code now includes type coercion for numbers
- Nested Collection Type Discovery: Fixed bug where nested collection types (e.g.,
Vec<HashMap<String, Vec<T>>>) were not properly discovered when the type was not referenced standalone- Type analyzer now recursively traverses nested generic types to discover all referenced custom types
- Ensures all nested types are included in the generated TypeScript bindings
- Cleaned up unused permissions directory from project structure
- Zod Command Generation with Channels: Fixed bug where commands with both regular parameters and channels generated invalid TypeScript code
- Previously referenced non-existent
extractChannelsfunction - Now generates explicit channel parameter references (e.g.,
{ ...result.data, onProgress: params.onProgress })
- Previously referenced non-existent
-
Tauri Channel Support: Automatically generate TypeScript bindings for Tauri IPC Channels
- New
ChannelParserdetectsChannel<T>parameters in commands - Generates TypeScript channel listener boilerplate with proper typing
- Supports both bare
Channel<T>and qualifiedtauri::ipc::Channel<T>syntax
- New
-
Tauri Event Support: Automatically discover and generate TypeScript event listeners
- New
EventParserdetectsapp.emit(),window.emit(), andapp.emit_to()calls - Generates TypeScript event listener boilerplate with proper payload types
- Infers payload types from emitted expressions (structs, primitives, variables)
- Discovers events in conditionals, loops, match arms, and nested blocks
- Auto-imports event payload types in generated
events.ts
- New
-
Serde Attribute Support: Respect Serde serialization attributes
#[serde(rename = "customName")]- field-level renaming#[serde(rename_all = "camelCase")]- struct-level naming convention (camelCase, snake_case, PascalCase, kebab-case, SCREAMING_SNAKE_CASE, SCREAMING-KEBAB-CASE)#[serde(skip)]- exclude fields from generated types- Field renames properly override struct-level conventions
- Applies to both structs and enums with variant-level rename support
-
Improved Tauri Parameter Filtering: More robust detection of Tauri-specific parameters
- Properly filters
AppHandle,Window,WebviewWindow,State<T>,Manager,Channel<T>,Request - Handles both fully-qualified (
tauri::AppHandle) and imported (AppHandle) types - Uses AST-based type checking instead of string matching
- Prevents false positives for user types with similar names
- Properly filters
-
GitHub Actions CI/CD: Automated testing and code coverage
- Runs tests, formatting checks, and Clippy linting on all PRs and pushes
- Generates code coverage reports with
cargo-tarpaulin - Uploads coverage to Codecov automatically
-
Git Hooks with cargo-husky: Automatic code formatting on commit
- Pre-commit hook runs
cargo fmtautomatically - Auto-stages formatted files for commit
- Pre-commit hook runs
-
BREAKING: Default validation library changed from
"zod"to"none"- Running
generatewithout--validationflag now generates vanilla TypeScript - Explicit
--validation zodrequired for Zod schema generation
- Running
-
BREAKING: Removed all Tauri runtime dependencies
- Removed
tauridependency fromCargo.toml(was only needed for plugin feature) - Removed
tauri-pluginbuild dependency - Removed plugin-specific code from
build.rs - Removed mobile-specific error variant (
PluginInvokeError) - Project is now a pure code generation library with no runtime requirements
- Eliminates glib-sys dependency issues in CI environments
- Removed
-
Code Quality Improvements:
- Converted recursive methods to associated functions (static methods) to eliminate clippy warnings
- Changed methods like
type_to_string(&self, ty)totype_to_string(ty)whereselfwas only used for recursion - Cleaner, more honest API that accurately reflects function dependencies
-
JavaScript/TypeScript Build Setup: Removed all Node.js-based build infrastructure
- Removed
package.json,rollup.config.js,tsconfig.json - Removed
guest-js/directory (was for plugin guest code) - Tool is now purely a Rust CLI with no JavaScript build dependencies
- Removed
-
Old Example App: Removed outdated
examples/tauri-app/directory- Example apps have been reorganized but not committed to repository
- Cleaner project structure focused on the core library
-
Fixed vanilla TypeScript generator not using camelCase for function names
- Command functions now properly convert from snake_case to camelCase (e.g.,
get_user_count→getUserCount())
- Command functions now properly convert from snake_case to camelCase (e.g.,
-
Fixed Channel message types not being included in generated type files
- Channel generic types are now properly extracted and collected
Channel<T>now ensuresTis exported intypes.ts- Event payload types are now auto-imported in
events.ts
-
Fixed TypeScript compilation errors for command parameter interfaces
- Parameter interfaces now include
[key: string]: unknown;index signature - Satisfies Tauri's
InvokeArgstype requirement - Only applies to parameter interfaces, not response types
- Parameter interfaces now include
-
Fixed verbose mode propagation through AST parsing steps
- Verbose logging now works consistently across all analysis phases
- CRITICAL: Fixed CLI arguments being ignored when configuration file exists
- CLI arguments (
--validation,--project-path,--output-path) now properly override config file settings - Previously, when a config file was present, CLI flags were replaced by their default values, causing user-specified options to be ignored
- Changed CLI argument types to
Option<T>to distinguish between "not specified" and "specified with default value" - Boolean flags (
--verbose,--visualize-deps) now only override config when explicitly provided - Fixes issue where running without
--validationflag would ignore config file's validation library setting
- CLI arguments (
- CLI argument precedence is now: CLI Arguments > Config File > Hardcoded Defaults
- Improved help text for CLI arguments to clarify default behavior and config file integration
- Added optional hook feature for customizing generated TypeScript code
- Allows users to inject custom code transformations into the generation process
- Comprehensive test coverage for hook functionality
- Added build timestamp and crate version information to generated files
- Generated files now include metadata about when and with which version they were created
- BREAKING: Renamed crate from
tauri-plugin-typegentotauri-typegen- Updated all references, imports, and documentation
- Updated package names in both Cargo.toml and package.json
- Updated capability permissions and schema references
- Fixed regression where
Optionalcustom types were not exported properly - Fixed regression where primitve types were not imported properly
- Added support for custom validation error messages in Zod schemas
- Validator
messageparameters are now extracted from Rust#[validate(...)]attributes - Error messages are properly escaped and included in Zod schema validations
- Supports messages for
length,range,email, andurlconstraints - Example:
#[validate(length(min = 5, max = 50, message = "Must be 5-50 chars"))]generatesz.string().min(5, { message: "Must be 5-50 chars" })
- Validator
- Fixed vanilla TypeScript interface properties not using camelCase naming convention
- Interface properties now consistently use camelCase (e.g.,
stringMapinstead ofstring_map) - Matches the naming convention already used in Zod schemas for consistency
- Interface properties now consistently use camelCase (e.g.,
- Updated
z.record()generation to use explicit two-parameter syntax for better type safety- Now generates
z.record(z.string(), z.number())instead ofz.record(z.number()) - More explicit about both key and value types
- Now generates
- Fixed camelCase naming convention not being consistently applied to generated TypeScript types
- Fixed configuration file not being properly loaded from
tauri.conf.json - Fixed topological sorting and forward references in type dependency resolution after refactoring
- Fixed CLI config loading to properly detect and use
tauri.conf.jsonfrom project directory
- Changed enum generation to use Zod native enums (
z.enum()) instead of union types
- Fixed invalid
tauri.conf.jsongeneration when using standalone configuration files - Fixed
tauri.conf.jsonpath resolution to correctly place file in Rust project directory ({project-path}/tauri.conf.json) - Improved path detection for default configuration file location using proper parent directory checks
- Reduced CLI verbosity with cleaner progress output using animated spinners (indicatif library)
- Updated
initcommand to require existingtauri.conf.jsonand only update theplugins.typegensection - Configuration file now defaults to
{project-path}/tauri.conf.jsoninstead of project root - Enhanced verbose mode to properly propagate through AST parsing and analysis steps
- Added
indicatifdependency for progress bar animations - Added comprehensive tests for CLI configuration conversion
- Added tests for tauri.conf.json preservation and plugin section management
- Fixed invalid
tauri.conf.jsongeneration when using standalone configuration files - Fixed
tauri.conf.jsonpath resolution to correctly place file in project directory - Improved path detection for default configuration file location
- Reduced CLI verbosity with cleaner progress output using animated spinners
- Improved user experience with single-line progress indication during generation
- Removed unnecessary info emojis from logging output
- Updated
initcommand to require existingtauri.conf.jsonand only update theplugins.typegensection - Configuration file now defaults to
{project-path}/tauri.conf.jsoninstead of project root
- Initial release of tauri-typegen
- TypeScript bindings generation for Tauri commands
- Support for Zod validation library integration
- Support for vanilla TypeScript types (no validation)
- AST caching for improved performance
- Single-pass traversal for efficient code analysis
- Optional dependency graph visualization (text and DOT formats)
- CLI with
generateandinitcommands - Configuration file support (standalone JSON or integrated with
tauri.conf.json) - Comprehensive type mapping for Rust to TypeScript conversion
- Support for complex types including:
- Structs and enums
- Generic types
- Collections (Vec, HashMap, HashSet, BTreeMap, BTreeSet)
- Option and Result types
- Tuples
- Topological sorting for proper type dependency ordering
- Command discovery via
#[tauri::command]attribute parsing - Automatic generation of barrel exports (
index.ts)
- Zod Generation Mode: Generates schemas, inferred types, commands, and exports
- Vanilla TypeScript Mode: Generates types, commands, and exports without validation
- Verbose Mode: Detailed logging for debugging and understanding the generation process
- Modular Architecture:
- Separate analyzer submodules for commands, types, and dependencies
- Strategy pattern for generator implementations
- Clean separation between AST parsing and code generation
- Progress reporting with step-by-step feedback
- Helpful error messages with actionable guidance
- Usage examples printed after successful generation
- Dependency visualization tools for understanding type relationships
- Extensive test coverage