fix: preserve signature of observable function children (#631, #521) - #662
Open
trinadhkoya wants to merge 1 commit into
Open
fix: preserve signature of observable function children (#631, #521)#662trinadhkoya wants to merge 1 commit into
trinadhkoya wants to merge 1 commit into
Conversation
trinadhkoya
force-pushed
the
fix/631-function-children-arg-signature
branch
from
August 30, 2026 16:32
c9feddc to
b9d22c6
Compare
Function children that returned a non-void value were reduced to `() => t` in `ObservableFunctionChildren`, dropping their parameters, so calling such a function failed to type-check with "Expected 0 arguments, but got 1". The same reduction unwrapped the return type of async function children with no arguments, turning `Promise<T>` into `T`. Use the original function type `T[K]` so the full call signature and return type are preserved. Fix proposed by the reporter in LegendApp#631. Closes LegendApp#631 Closes LegendApp#521
trinadhkoya
force-pushed
the
fix/631-function-children-arg-signature
branch
from
August 30, 2026 16:35
b9d22c6 to
1490651
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #631 and #521 — both stem from the same reduction in the
ObservableFunctionChildrentype.Function children stored in an observable that return a non-void value had their signature reduced to
() => t:Promise<T>return unwrapped toT:Fix
In
src/observableTypes.ts,ObservableFunctionChildrennow intersects with the original function typeT[K]instead of() => t, preserving the full call signature and return type:This is the fix proposed by the original reporter in #631.
Tests
Added type tests in
tests/types.test.ts:issue #631— asserts the argument signature is preserved (fails on the old type withExpected 0 arguments, but got 1).issue #521— asserts an async no-arg child keeps itsPromise<number>return type.Both tests fail against the previous type and pass with the fix.
Verification
npm run lint:check✅npm run format:check✅npm run typecheck✅ (fails without the fix, confirming the new tests guard it)npm run build✅