fix(atoms): make Signal passable to functions accepting ZeduxNode#341
Merged
fix(atoms): make Signal passable to functions accepting ZeduxNode#341
Conversation
99cc403 to
da74de0
Compare
da74de0 to
7f35897
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.
Description
The
Signalclass's generics omit theParamsandTemplategenerics from the NodeGenerics accepted by the base ZeduxNode class. This is because Signals don't have Params and Template, but it means that a Signal can't be passed to a function accepting any ZeduxNode without some hacky TS workarounds.To fix this,
Signalneeds to require theParamsandTemplategenerics. I fixed that. And since this is obnoxious for all consumer code, I've added anAnySignaltype helper patterned afterAnyAtomInstance&co:Add tests that verify existing types still work and these changes are working correctly. Also add tests ensuring all cross-assignments work - e.g. a MappedSignal can be passed anywhere a Signal or ZeduxNode is expected, same for AtomInstance, and a SelectorInstance can be passed anywhere a ZeduxNode is expected. In all cases, the passed node must match on any required generics.