Skip to content

Conversation

@joetannenbaum
Copy link
Collaborator

This PR adds a generic type to the stream hooks that allows the user to specify the shape of the send method:

const { send } = useStream<{ messages: string[]}>();

send({
    messages: ['first', 'second', 'third']
})

It includes one small breaking change: Previously, the first generic type passed into useStream was to specify the JSON shape if using the json option, now the send payload is the first generic and the JSON shape is the second.

For useJsonStream the JSON payload remains the first generic, the send payload is the now the second.

@joetannenbaum joetannenbaum merged commit 18570ae into main May 27, 2025
7 checks passed
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.

2 participants