Skip to content

feat(isr): check revalidate paths against routes with typedRoutes - #740

Merged
cpojer merged 3 commits into
voidzero-dev:mainfrom
yangshun:claude/typed-revalidate-paths
Nov 7, 2026
Merged

cpojer merged 3 commits into
voidzero-dev:mainfrom
yangshun:claude/typed-revalidate-paths

Conversation

@yangshun

@yangshun yangshun commented Nov 7, 2026

Copy link
Copy Markdown
Collaborator

Summary

revalidate({ paths }) from void/isr now checks its paths against the app's routes when routing.typedRoutes is on, like Link, the router methods, and c.rewrite().

  • RevalidateOptions.paths is RouteUrl[] instead of string[]. With the flag off, RouteUrl is string, so untyped apps see no change.
  • A path TypeScript can't check, such as one from a webhook payload, needs as RouteUrl. The cast turns the check off for that path.
  • routing.prerender is unchanged. It lives in void.config.ts, which is outside the app's TypeScript project.

Docs

  • guide/edge/revalidation.md and reference/api/resources.md: drop the satisfies RouteUrl[] workaround (from docs: annotate route paths and params in examples #728), say the paths are checked with routing.typedRoutes, and explain the as RouteUrl escape hatch. The signature now shows RouteUrl[].
  • guide/type-safety.md: add revalidate({ paths }) to "Checked URL strings" and the RouteUrl bullet, and split the "What Gets Checked" row so revalidate and routing.prerender are listed separately. routing.prerender keeps its satisfies RouteUrl[] guidance, now shown in a void.config.ts example. The existing cast paragraph now says the cast turns the check off.
  • reference/config.md (routing.typedRoutes): list revalidate({ paths }) among the checked APIs.

Tests

  • route-url-builder.test.ts (typed fixture, through both the generated and package declarations): known paths, a `/users/${id}` template literal, and a RouteUrl pass. An unknown path and a plain string[] are @ts-expect-error. string[] as RouteUrl[] passes. I checked that the new @ts-expect-error lines fail against the old string[] declaration.
  • typed-navigation.typecheck.ts: with the flag off, a plain string[] and an unknown path still pass.

Verification: the focused test passes, as do vp run check, vp run test, and vp test run (781 files, 16,156 tests).

🤖 Generated with Claude Code

`revalidate({ paths })` now takes `RouteUrl[]`, so with
`routing.typedRoutes` on each path must match one of the app's routes.
With the flag off `RouteUrl` is `string`, so untyped apps see no change.
A path TypeScript cannot check needs `as RouteUrl`, which turns the
check off for that path.

The docs drop the `satisfies RouteUrl[]` workaround for `revalidate`.
`routing.prerender` keeps its existing guidance.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cpojer
cpojer self-requested a review November 7, 2026 09:57
cpojer
cpojer previously approved these changes Nov 7, 2026

@cpojer cpojer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@cpojer
cpojer merged commit d5fff54 into voidzero-dev:main Nov 7, 2026
18 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