Repository navigation
feat(routes): check SSE and live stream client URLs with typedRoutes - #741
Merged
cpojer merged 2 commits intoNov 7, 2026
Merged
Conversation
With `routing.typedRoutes` on, `connectEventStream()` and `connectLiveStream()` accept one of the app's route URLs, an absolute `http://`/`https://` URL, or a `URL` object. Unknown paths, WebSocket, `mailto:`, `tel:`, same-page URLs and unchecked strings are type errors. With the flag off, the parameter stays `string | URL`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rls-c3b477 # Conflicts: # docs/guide/type-safety.md # docs/reference/config.md # packages/void/test/integration/route-url-builder.test.ts
cpojer
self-requested a review
November 7, 2026 09:57
yangshun
added a commit
to yangshun/void
that referenced
this pull request
Nov 7, 2026
The main merge kept only this branch's side of the type-safety guide, which dropped the stream client paragraph that voidzero-dev#741 added. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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
With
routing.typedRouteson, theurlargument ofconnectEventStream()(void/sse/client) andconnectLiveStream()(void/live/client) is now checked against the app's routes, likeLink, router methods andc.rewrite().Both clients accept:
`/api/users/${id}`),http://orhttps://URL, for a stream on another origin,URLobject.They reject unknown paths,
ws:///wss://,mailto:,tel:, same-page?/#URLs and uncheckedstringvalues. A string TypeScript can't check is cast withas RouteUrl, which turns the check off for that URL.With the flag off, the parameter stays
string | URL.Neither client has a base-URL option: a path always resolves against the page's origin, so route checking applies to every relative string. The accepted string type (
RequestUrlinroute-url.ts) stays internal rather than being exported fromvoid/routes;Hrefwas not reused because it also allowsmailto:,tel:and same-page URLs.Docs
docs/guide/sse.md,docs/guide/live.md: whattypedRouteschecks for the client URL and how to cast.docs/guide/type-safety.md: "Checked URL strings" list, a paragraph on stream URLs, and the "What Gets Checked" table.docs/reference/config.md:routing.typedRoutes.Tests
packages/void/test/integration/route-url-builder.test.ts: the typed fixture (generated and package declarations) accepts a known route, a dynamic template literal, aRouteUrl,http(s)URLs, aURLand aRouteUrlcast; it rejects an unknown path,ws:///wss://,#detailsand an uncheckedstring. Reverting the SSE client's parameter tostring | URLindistmakes the four SSE@ts-expect-errorlines fail.packages/void/test/unit/typed-navigation.typecheck.ts: with the flag off, both parameters are exactlystring | URL.🤖 Generated with Claude Code