fix(tanstack-start): resolve consuming-app type errors in routes and server fns#17121
Conversation
…server fns Tightens three public type surfaces in @payloadcms/tanstack-start so that consuming TanStack Start apps typecheck without local `.d.ts` patches or `as any` escapes. AdminNotFound now accepts TanStack's NotFoundRouteProps (data: unknown) and narrows it through a real type guard rather than a wide prop annotation. The old shape was contravariant with notFoundComponent and surfaced TS2345 at the route-options call site in consuming apps. loadAdminPage and loadLayoutData re-type their server-function return values to match what renderServerComponent actually produces. TanStack 1.168 added a compile-time serialization guard on createServerFn return types; rscPayload / providers typed as React.ReactNode tripped SerializationError, and loadLayoutData's Record<string, unknown> failed on unknown index values. Both now use the serializable RenderedRsc handle, and clientConfig is surfaced as plain JSON (its static type carries irreducible deep unknown/function members that toSerializable strips at runtime).
|
Pull Request titles must follow the Conventional Commits specification and have valid scopes. Unknown scope "tanstack-start" found in pull request title "fix(tanstack-start): resolve consuming-app type errors in routes and server fns". Scope must match one of: cpa, claude, codemod, db-*, db-d1-sqlite, db-mongodb, db-postgres, db-vercel-postgres, db-sqlite, db-d1-sqlite, drizzle, email-*, email-nodemailer, email-resend, eslint, evals, graphql, kv, kv-redis, live-preview, live-preview-react, live-preview-vue, next, payload-cloud, plugin-cloud, plugin-cloud-storage, plugin-ecommerce, plugin-form-builder, plugin-import-export, plugin-mcp, plugin-multi-tenant, plugin-nested-docs, plugin-redirects, plugin-search, plugin-sentry, plugin-seo, plugin-stripe, richtext-*, richtext-lexical, sdk, skills, storage-*, storage-azure, storage-gcs, storage-r2, storage-uploadthing, storage-vercel-blob, storage-s3, translations, ui, templates, examples(/(\w|-)+)?, deps. |
…-start-consuming-app-types
📦 esbuild Bundle Analysis for payloadThis analysis was generated by esbuild-bundle-analyzer. 🤖
Largest pathsThese visualization shows top 20 largest paths in the bundle.Meta file: packages/next/meta_index.json, Out file: esbuild/index.js
Meta file: packages/payload/meta_index.json, Out file: esbuild/index.js
Meta file: packages/payload/meta_shared.json, Out file: esbuild/exports/shared.js
Meta file: packages/richtext-lexical/meta_client.json, Out file: esbuild/exports/client_optimized/index.js
Meta file: packages/ui/meta_client.json, Out file: esbuild/exports/client_optimized/index.js
Meta file: packages/ui/meta_shared.json, Out file: esbuild/exports/shared_optimized/index.js
DetailsNext to the size is how much the size has increased or decreased compared with the base branch of this PR.
|
Tightens the public type surfaces in
@payloadcms/tanstack-startso consuming TanStack Start apps typecheck without error.This affects consuming apps in thw following files:
app/_payload/admin.$.tsx:app/_payload/api.$.ts: