Skip to content

Improve typings for message stream events#8

Merged
philnash merged 1 commit into
langflow-ai:mainfrom
tifilipebr:types/message-stream-event
Sep 1, 2025
Merged

Improve typings for message stream events#8
philnash merged 1 commit into
langflow-ai:mainfrom
tifilipebr:types/message-stream-event

Conversation

@tifilipebr
Copy link
Copy Markdown
Contributor

This PR adds the MessageStreamEventData interface and updates the AddMessageStreamEvent type to use this interface instead of unknown.
This improves TypeScript typing for message stream events, making the code safer and easier to work with.

Changes

  • Define the new MessageStreamEventData interface in types.ts.
  • Replace unknown with MessageStreamEventData in the AddMessageStreamEvent type.

Motivation

Enhances type safety and developer experience by providing proper typings for streamed messages.

Checklist

All steps from the contributing guide have been completed:

  • Dependencies installed (npm install)
  • Tests run (npm test)
  • Code transpiled (npm run build)
  • Linting passed (npm run lint)
  • Formatting applied and checked (npm run format / npm run format:check)

@philnash
Copy link
Copy Markdown
Member

Hey @tifilipebr, thanks for the PR! I am just confirming with the Langflow team that the add_message event always looks like this. There is a lot of flexibility in responses from the Langflow API, so I wanted to ensure this was correct before setting it. (That's why I originally typed it as unknown).

Will get back to you soon.

@tifilipebr
Copy link
Copy Markdown
Contributor Author

Hi Phil, that’s great! I defined these types based on some responses I observed during usage, but I agree it would be important to confirm against the specifications to ensure consistency for consumers. Thanks for the attention and the reply, and I hope we can keep improving the typings. Cheers!

@philnash philnash merged commit 9f9cd45 into langflow-ai:main Sep 1, 2025
1 check 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