-
Notifications
You must be signed in to change notification settings - Fork 3
fix: Make props optional in rerender
function returned from renderHookToSnapshotStream
#14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
rerender
function returned from renderHookToSnapshotStream
rerender
function returned from renderHookToSnapshotStream
af16f41
to
f7b9229
Compare
commit: |
…HookToSnapshotStream`
f7b9229
to
0167414
Compare
: Arg | ||
: Arg | ||
|
||
export async function renderHookToSnapshotStream<ReturnValue, Props = void>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can actually reach the same result, but more situational and "correct" by defaulting Props
to void
instead of the default unknown
.
This way if you have an actual argument defined for the function, it will stay required, but if there is no argument it will be void
, making it optional.
We do need a little bit more work to also correctly work if the function argument is optional from the start - the VoidOptionalArg
takes care of that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I never really liked it that rerender
was so loose, so I think this could solve it more correctly. Could you please give this a re-review from your side @jerelmiller?
If you're happy with this, merge the branch and it will immediately be released.
@phryneas I would agree, I like the idea of making it optional only if its truly optional. RTL ended up changing my mind, but happy to go this route for this package. Thanks for the assist! |
Fixes #13
Makes the
props
argument optional in thererender
function returned fromrenderHookToSnapshotStream
. This aligns it with RTL'srerender
function returned fromrenderHook
.