Releases: gjsify/ts-for-gir
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
gunichar
from number type resolution to string type resolution in type utilities - Array handling: Updated primitive array type resolution to properly handle
gunichar
arrays as string arrays - Type consistency: Ensures
gunichar
parameters and return values are correctly typed asstring
throughout 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_to
andtransform_from
parameters inbind_property_full
are 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
Transformation
class 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-name
andchanged::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_entries
method in GIO (#219) - Made
GObject.ParamSpec.*
blurb and nick properties nullable (#224) - Added
Cogl.SnippetHook
support forShell.GLSLEffect.add_glsl_snippet
(#236) - Replaced keyword
module
withnamespace
for 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.
4.0.0-beta.19
What's Changed
- fix(#195): Enable instanceof checks by @JumpLink in #214
- Add Requires property to MetaInfo by @JumpLink in #216
- Inject more IterableIterator and AsyncIterableIterator types for Gtk 4 and Gio by @JumpLink in #215
- Add Gtk 4 generics for FlowBox.bind_model ,ListBox.bind_model and StringList by @JumpLink in #212
- Mark enum parameters as nullable by @JumpLink in #213
- Upgrade ESLint 8 to 9 by @JumpLink in #217
Full Changelog: 4.0.0-beta.18...4.0.0-beta.19
4.0.0-beta.18
Fixed wrong return types for some promisified methods like load_contents_async
and similar methods, see #211
Full Changelog: 4.0.0-beta.17...4.0.0-beta.18
4.0.0-beta.17
4.0.0-beta.17 - Support for Promisified Method Types 🎉
We're excited to announce full TypeScript support for promisified methods, now enabled by default and available in the published NPM types. The implementation uses TypeScript overloads, providing:
- Automatic Promise return types when the callback argument is omitted
- Backward compatibility with original types when using callbacks
- Full integration with the type system
Check out our new example demonstrating asynchronous file operations with the new typing system.
Note: As this is a new feature, we welcome your feedback and real-world usage reports.
What's Changed
- ✨ Add promisified overload methods (@JumpLink in #210)
- 🔄 Implement promisification for class members in typescript generator (@ewlsh in #177)
- 📝 Add example code for promisified methods
- 📦 Update dependencies
- 🔄 Update GIR files
Full Changelog: 4.0.0-beta.16...4.0.0-beta.17
4.0.0-beta.16
What's Changed
- Improve System module types by @swsnr in #202
- Add GLib.Error.stack property by @swsnr in #201
- Upgrade dependencies
- Upgrade GNOME Shell 47
.gir
files - Upgrade
.gir
from latest version in Fedora Workstation 41 Beta
Full Changelog: 4.0.0-beta.15...4.0.0-beta.16
4.0.0-beta.15
What's Changed
- feat(GObject): Add missing TYPE_JSOBJECT definition by @JumpLink in #189
- Upgrade gir files
- Upgrade dependencies
Full Changelog: 4.0.0-beta.14...4.0.0-beta.15