Skip to content

Releases: gjsify/ts-for-gir

4.0.0-beta.38

21 Sep 20:10
4f64eae

Choose a tag to compare

  • GIR source update: Added devdocsgjs submodule and refreshed GNOME Shell GIRs from gjs-docs.gnome.org.
  • Docs restored: St-17.gir and Shell-17.gir were previously generated from .typelib and 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

19 Sep 09:04
25e11e8

Choose a tag to compare

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 integration
    • di-tsyringe: Traditional DI with parameter decorators
    • di-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.gir for 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 project
  • generate-missing-girs.sh: Generate missing GIR files

Links

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

20 Aug 19:43
c4e8ad4

Choose a tag to compare

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 their package.json dependencies
    • This fix ensures generated TypeScript packages have correct dependency versions
    • No breaking changes - only corrects existing version mismatch

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

  • Fix GObject and Gio library version dependencies by @gjsify in #285

Full Changelog: 4.0.0-beta.35...4.0.0-beta.36

4.0.0-beta.35

20 Aug 05:03
30d06c2

Choose a tag to compare

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:

🔗 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 both ListModel and Paintable implementations with the elegant declare pattern
  • 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

15 Aug 17:06
52a1d71

Choose a tag to compare

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() and registerClass
  • 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: true in 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 null as default value
  • TYPE_FLOAT Support (PR #269): Added missing GObject.TYPE_FLOAT by @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

⚠️ Advanced Variant Types are now enabled by default

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_FLOAT support
  • @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

18 Jun 09:48
500db86

Choose a tag to compare

🐛 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 as string 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 and transform_from parameters in bind_property_full are now correctly typed as Closure | 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

17 Jun 05:32

Choose a tag to compare

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 like notify::property-name and changed::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

👉 Compare v4.0.0-beta.23...v4.0.0-beta.24

v4.0.0-beta.23

21 Mar 19:40
d3228fc

Choose a tag to compare

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.

Full Changelog

v4.0.0-beta.21

17 Feb 18:52
cd7cbc3

Choose a tag to compare

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

17 Feb 14:41
5526efd

Choose a tag to compare

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 for Shell.GLSLEffect.add_glsl_snippet (#236)
  • Replaced keyword module with namespace 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:

For the complete list of changes, please see the full changelog.