Skip to content

Fix SignalMethods.connect callback return type - #129

Merged
JumpLink merged 1 commit into
mainfrom
fix/signalmethods-connect-return
Jun 29, 2026
Merged

Fix SignalMethods.connect callback return type#129
JumpLink merged 1 commit into
mainfrom
fix/signalmethods-connect-return

Conversation

@JumpLink

Copy link
Copy Markdown
Collaborator

SignalMethods.connect typed its callback return as boolean | undefined. That rejects the most common handler shape — one that returns nothing — because a void-returning function is not assignable to boolean | undefined:

events.connect('changed', () => {
    doSomething(); // returns void -> Type 'void' is not assignable to 'boolean | undefined'
});

Switching to boolean | void accepts both a void-returning handler and one that returns true to stop emission, which matches the imports.signals runtime semantics (only true stops emission — see _signals.js).

Fixed here for now; the file already carries a TODO to upstream SignalMethods into @girs/gjs, where the same type lives — that's a separate change in the types generator.

Validated locally (build:types, prettier:check, validate:types, validate:example) — all green.

Closes #116

SignalMethods.connect typed its callback return as
`boolean | undefined`, which rejected the common case of a handler
that returns nothing — a void-returning function is not assignable
to `boolean | undefined`.

Use `boolean | void` so handlers may return nothing or `true` to
stop emission, matching imports.signals semantics (only `true`
stops emission).

Closes #116
@JumpLink
JumpLink merged commit 1937402 into main Jun 29, 2026
1 check passed
@JumpLink
JumpLink deleted the fix/signalmethods-connect-return branch June 29, 2026 16:12
@JumpLink
JumpLink restored the fix/signalmethods-connect-return branch June 29, 2026 16:32
@JumpLink

Copy link
Copy Markdown
Collaborator Author

These changes were merged prematurely by mistake; main has been rewound to before the merge so the change can go through review first. Superseded by #133 (same branch/commits).

@JumpLink
JumpLink deleted the fix/signalmethods-connect-return branch June 30, 2026 22:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Issue with SignalMethods.connect

1 participant