Releases: gjsify/ts-for-gir
4.0.0-beta.38
- GIR source update: Added
devdocsgjssubmodule and refreshed GNOME Shell GIRs fromgjs-docs.gnome.org. - Docs restored:
St-17.girandShell-17.girwere previously generated from.typeliband lost docs; using upstream GIRs restores them. - Type-only change: No runtime code changes.
See #294 for more details.
Full changelog: v4.0.0-beta.37...v4.0.0-beta.38
4.0.0-beta.37
New Examples:
- Dex File Operations: New example demonstrating hybrid usage of Dex (libdex) in GJS/TypeScript
- Dependency Injection: Three comprehensive DI examples:
di-needle: Automatic DI resolution with GObject integrationdi-tsyringe: Traditional DI with parameter decoratorsdi-wise: Type-safe DI with interface-based tokens
GNOME 49 Preparation:
- New GIR files for GNOME 49 compatibility
- New major versions:
Clutter-17,Meta-17,St-17,Mtk-17 Ide-49.girfor GNOME Builder types- Complete GTK, WebKit and GStreamer updates
Infrastructure Improvements
Automation:
- New scripts in
./scripts/for GIR/Typelib management sync-typelibs-to-girs.sh: Sync system typelibs to projectgenerate-missing-girs.sh: Generate missing GIR files
Links
- Full Changelog: 4.0.0-beta.36...v4.0.0-beta.37
- PR #288: Dex File Operations example
- PR #290: Dependency Injection examples
- PR #292: GNOME 49 Release Preparation
This release makes ts-for-gir ready for GNOME 49 and provides developers with modern DI patterns as well as comprehensive GNOME API coverage.
4.0.0-beta.36
This is a minor maintenance release that fixes incorrect version numbers in GObject and Gio package dependencies. No new features have been added.
🐛 Bug Fixes
- Fixed incorrect library versions for GObject and Gio dependencies (#285)
- GObject and Gio packages were using incorrect GIR namespace version (
2.0.0) instead of the actual GLib library version (2.84.4) in theirpackage.jsondependencies - This fix ensures generated TypeScript packages have correct dependency versions
- No breaking changes - only corrects existing version mismatch
- GObject and Gio packages were using incorrect GIR namespace version (
Before:
"@girs/gobject-2.0": "2.0.0-4.0.0-beta.35"
"@girs/gio-2.0": "2.0.0-4.0.0-beta.35"After:
"@girs/gobject-2.0": "2.84.4-4.0.0-beta.36"
"@girs/gio-2.0": "2.84.4-4.0.0-beta.36"📦 What's Changed
Full Changelog: 4.0.0-beta.35...4.0.0-beta.36
4.0.0-beta.35
This release brings significant improvements to GObject interface implementation and introduces a new modern GTK 4 template example.
✨ What's New
🔧 Virtual Interface Generation for GObject Interfaces
Major Feature: Implemented virtual interface generation that creates separate Interface namespaces containing only the virtual methods (vfunc_*) that need to be implemented. This matches the GObject-Introspection pattern and significantly improves the developer experience and fixes #223.
Before (required implementing ALL methods):
// ❌ This didn't work - required implementing ALL methods
class CustomImage implements Gdk.Paintable {
// Must implement ALL methods, properties, signals, etc.
}After (only implement virtual methods):
// ✅ This works - only implement virtual methods
class CustomImage implements Gdk.Paintable.Interface {
// Only implement vfunc_* methods
vfunc_get_current_image(): Gdk.Paintable { ... }
vfunc_get_flags(): Gdk.PaintableFlags { ... }
}⚡ Elegant TypeScript Integration with declare Pattern
New Implementation Pattern: Introduced an elegant approach using declare statements for TypeScript compatibility while implementing only the required virtual functions.
class CustomPaintable implements Gdk.Paintable.Interface {
// Declare for TypeScript compatibility
declare get_current_image: Gdk.Paintable["get_current_image"];
declare get_flags: Gdk.Paintable["get_flags"];
// Implement only virtual functions
vfunc_get_current_image(): Gdk.Paintable { ... }
vfunc_get_flags(): Gdk.PaintableFlags { ... }
}Benefits:
- 🔒 Full TypeScript Type Safety - Complete IntelliSense and compile-time checking
- ⚙️ Clean Separation - Interface declarations separate from implementations
- 🔄 No Duplication - GJS automatically delegates to virtual functions
- 🚀 Better Developer Experience - Focus on what you need to implement
🎨 New GTK 4 Template Blueprint + Vite Example
New Example: Added gtk-4-template-blueprint-vite/ showcasing modern Blueprint + Vite integration for TypeScript applications.
Features:
- 🔵 Blueprint Support - Direct import of
.blpfiles using the Vite plugin - 📦 Plugin Integration - Uses
@gjsify/vite-plugin-blueprint
🔗 Pull Requests Included
- #281 - Implement Virtual Interface Generation for GObject Interfaces
- #284 - Add GTK 4 Template Blueprint + Vite Example
📚 Documentation & Examples
- Updated Examples:
examples/gio-2-list-model/now demonstrates the new virtual interface pattern - New Example:
examples/virtual-interface-test/demonstrates bothListModelandPaintableimplementations with the elegantdeclarepattern - Comprehensive Guides: Added virtual interface pattern documentation with implementation examples
- Pattern Documentation: Both example READMEs include comprehensive virtual interface pattern guides
- Blueprint + Vite Template: Check out the new
examples/gtk-4-template-blueprint-vite/for a complete example of using Blueprint UI files with Vite and TypeScript
Full Changelog: Compare v4.0.0-beta.34...v4.0.0-beta.35
4.0.0-beta.34
We're excited to announce a major milestone release that brings significant architectural improvements, enhanced tooling, and completes the long-awaited integration of gi.ts advanced features!
🌟 Major Highlights
🎯 gi.ts Integration Completed (PR #279)
After the original merger of gi.ts and ts-for-gir, we've now completed the full integration by enabling the Advanced Variant Types originally developed by @ewlsh. This brings:
- Advanced Variant Types enabled by default: Enhanced TypeScript support for
GLib.Variant.deepUnpack()andregisterClass - Better Type Inference: More precise TypeScript definitions for GObject patterns
- Template System Migration: Moved from override code to EJS templates for better maintainability
- Backward Compatibility: Use
noAdvancedVariants: truein your config for legacy compatibility
// Now supported with enhanced type inference
const variant = GLib.Variant.new_string("hello");
const unpacked = variant.deepUnpack(); // Properly typed!🛠️ Complete Toolchain Simplification (PR #268, PR #275)
We've dramatically simplified the development experience:
- Prettier → Biome Migration: Centralized formatting/linting with significantly faster performance
- Direct TypeScript Execution: Core packages now run TypeScript directly without build steps
- Unified Configuration: Single Biome config for the entire monorepo
- Eliminated Build Dependencies: No more waiting for builds during development
# Before: Multiple slow formatters per package
yarn format # ~30s across packages
# After: Single fast formatter
yarn format # ~3s for entire monorepo📊 Advanced Problem Tracking & Reporting (PR #278)
Introduced a comprehensive debugging and analysis system:
- Structured Problem Tracking: Categorized error reporting with severity levels
- Advanced Filtering: Search and filter by category, severity, namespace, or text
- Statistical Analysis: Track common issues and problematic namespaces
# Generate detailed reports
yarn ts-for-gir generate --reporter --reporterOutput=debug-report.json
# Analyze critical issues
yarn ts-for-gir analyze -f ./report.json --severity critical --category type_resolution
# Export for AI analysis
yarn ts-for-gir analyze -f ./report.json --export issues.json --format csv- Proper NPM Publishing: Fixed critical npm distribution issues
🔧 Technical Improvements
Architecture Consolidation (PR #267)
- Circular Dependencies Resolved: Consolidated 7 class files into
introspected-classes.ts - Build System Optimization: Automatic dependency handling via
esbuild-node-externals - Code Simplification: Reduced file count and complexity
Language Server Foundation (PR #282)
- TypeScript Validation Infrastructure: Foundation for future LSP-based type validation
- CLI Stability Fixes: Fixed critical TypeScript compilation errors
- Testing Framework: Comprehensive test suite for validation
Bug Fixes & Enhancements
- ParamSpec.string() Fix (PR #280): Allow
nullas default value - TYPE_FLOAT Support (PR #269): Added missing
GObject.TYPE_FLOATby @Aylur - Float Property Example (PR #276): Added test case for float properties
- License & Dependencies Updates (PR #272, PR #274)
📈 Performance Improvements
- 3-10x Faster Formatting: Biome vs Prettier performance gains
- Instant Development Feedback: Direct TypeScript execution eliminates build wait times
- Reduced Bundle Size: Better dependency management and bundling
- Optimized CI/CD: Streamlined testing and validation processes
🔄 Breaking Changes
If you need legacy behavior, add to your config:
// .ts-for-girrc.js
module.exports = {
noAdvancedVariants: true // For legacy compatibility
}🎯 Examples & Use Cases
Enhanced GObject Development
// Better type inference for GObject properties
class MyObject extends GObject.Object {
static {
GObject.registerClass({
Properties: {
'ratio': ParamSpec.float(
'ratio', 'Ratio', 'A float ratio property',
ParamFlags.READWRITE,
0.0, 1.0, 0.5 // min, max, default
),
'name': ParamSpec.string(
'name', 'Name', 'Object name',
ParamFlags.READWRITE,
null // null now properly supported
)
}
}, this);
}
}🙏 Contributors
Special thanks to:
- @Aylur for their first contribution adding
TYPE_FLOATsupport - @ewlsh for the original Advanced Variant Types implementation in gi.ts
📚 Migration Guide
For Advanced Variants
Most users will benefit from the new Advanced Variants automatically. If you encounter issues, temporarily disable with:
module.exports = { noAdvancedVariants: true }Full Changelog: v4.0.0-beta.25...v4.0.0-beta.34
4.0.0-beta.25
🐛 Bug Fixes
Fix: Treat gunichar as string type instead of number (#265)
This release addresses a critical type mismatch issue where gunichar was incorrectly typed as number instead of string in GJS TypeScript definitions.
What was fixed:
- Core type resolution: Moved
gunicharfrom number type resolution to string type resolution in type utilities - Array handling: Updated primitive array type resolution to properly handle
gunichararrays as string arrays - Type consistency: Ensures
gunicharparameters and return values are correctly typed asstringthroughout generated TypeScript definitions
Why this matters:
In GJS, gunichar represents Unicode characters as strings, not numeric code points. This was causing type mismatches in functions like Gtk.TextCharPredicate where parameters expected strings but were typed as numbers.
Testing:
Added a new comprehensive test example (examples/glib-2-types/) that demonstrates proper type handling for various GLib string and Unicode functions, including UCS-4 conversion functions and Unicode character property functions.
Fix: Make bind_property_full Closure parameters nullable (#266)
Fixed incorrect TypeScript type definitions for GObject's bind_property_full method where transformation parameters were not properly nullable.
What was fixed:
- Parameter nullability:
transform_toandtransform_fromparameters inbind_property_fullare now correctly typed asClosure | null - Documentation alignment: Types now match the GObject documentation which clearly states these parameters can be "or %NULL to use the default"
- Upstream bug workaround: Added specific injection to handle missing
nullable="1"attributes in the GObject-2.0.gir file
Before:
bind_property_full(
// ...
transform_to: Closure, // ❌ Not nullable
transform_from: Closure, // ❌ Not nullable
): Binding;After:
bind_property_full(
// ...
transform_to: Closure | null, // ✅ Now nullable
transform_from: Closure | null, // ✅ Now nullable
): Binding;Why this matters:
This fix allows developers to pass null for transformation functions when using default property binding behavior, which is the most common use case. Previously, TypeScript would incorrectly flag this as a type error.
🔧 Technical Improvements
- Code refactoring: Moved transformation utilities from the
Transformationclass to reusable utility functions - Better documentation: Enhanced examples and documentation for property binding patterns
- Type safety: Improved type consistency across GLib string handling functions
🎯 Migration Notes
These fixes are backward compatible and don't require any changes to existing code. However, if you were working around the gunichar typing issue or the bind_property_full nullability issue, you can now remove those workarounds and use the correct types.
Full Changelog: v4.0.0-beta.24...v4.0.0-beta.25
v4.0.0-beta.24
This release introduces major improvements to signal handling and developer ergonomics, while keeping the ecosystem up-to-date and ready for advanced workflows such as JSX support.
✨ Highlights
-
Type-safe signal handling
Signal generation has been fully refactored and centralized. You now get precise typing for all GObject signals—including detail variants likenotify::property-nameandchanged::key-name.
This unlocks new capabilities like declarative JSX-based signal binding for frameworks that extend GJS with JSX (e.g. via Babel transforms):<Gtk.Button onClicked={callback} onNotifyDefaultWidth={() => {}} />
This pattern is now fully type-safe and enables better tooling, autocompletion, and refactoring.
🧪 See the new examples demonstrating this:
→ PR: #263
-
Cursor IDE rules
Added development rules for Cursor to support consistent and AI-enhanced developer workflows (#264).
🧹 Maintenance & Ecosystem
- 🔄 Updated all npm dependencies to latest versions (#260)
- 📦 Refreshed all GIR files from latest upstream (#261)
- 🧵 Upgraded Yarn from 4.7.0 → 4.9.2 (#262)
📦 Full Changelog
v4.0.0-beta.23
TS for GIR v4.0.0-beta.23 Release
Highlights
- 🎨 Improved Cairo Type Definitions: Significantly enhanced handwritten Cairo type definitions, resolving long-standing issues
- 🔧 Fixed Object property methods and GObject.ParamSpec.object parameter typing
- 🌐 Global gettext methods and pkg properties now properly defined
- ✨ Enhanced string formatting capabilities in TypeScript definitions
- 📦 Updated .gir files to latest versions
- ⬆️ Upgraded NPM dependencies
Details
This release focuses on fixing critical type issues, particularly for Cairo interfaces, and improving overall TypeScript definition accuracy. GLib.Variant typing has also been addressed, making your TypeScript GJS development experience smoother than ever.
v4.0.0-beta.21
This release adopts the types from GNOME 48
What's Changed
Full Changelog: v4.0.0-beta.20...v4.0.0-beta.21
v4.0.0-beta.20
Release v4.0.0-beta.20
🚀 Highlights
- Fixed several type definition issues in GObject and GTK libraries
- Improved documentation
- Updated dependencies to latest versions
🔧 Type Definition Improvements
- Fixed types for
ActionMap.add_action_entriesmethod in GIO (#219) - Made
GObject.ParamSpec.*blurb and nick properties nullable (#224) - Added
Cogl.SnippetHooksupport forShell.GLSLEffect.add_glsl_snippet(#236) - Replaced keyword
modulewithnamespacefor better TypeScript compatibility (#235)
📚 Documentation
- Improved installation instructions for Fedora users (#230)
🔄 Other Changes
- Attempted (#225) and reverted (#233) fix for LayoutManager generics
- Updated project dependencies to latest versions
👥 Contributors
Special thanks to:
- @laine-hallot (first contribution! 🎉)
For the complete list of changes, please see the full changelog.