Skip to content

The behavior of types and the actual object for context does not match #5371

@eve0415

Description

@eve0415

Which project does this relate to?

Start

Describe the bug

Passing context from fetch and also from requestMiddleware, __root.tsx's beforeLoad and loader has the expected types but when dumping the parameters, it shows empty object {} which does not match with the types.

  1. Passing fromFetch
    https://github.com/eve0415/tanstack-start-issues-repro/blob/3d4fbf9db47a2f21cc3c72fb441bbcff9272babb/src/server.ts#L7

  2. requestMiddleware can see fromFetch context
    https://github.com/eve0415/tanstack-start-issues-repro/blob/3d4fbf9db47a2f21cc3c72fb441bbcff9272babb/src/start.tsx#L3-L10

  3. beforeLoad and loader in __root.tsx or any other routes including serve routes can see the types available but getting empty context
    https://github.com/eve0415/tanstack-start-issues-repro/blob/3d4fbf9db47a2f21cc3c72fb441bbcff9272babb/src/routes/__root.tsx#L11-L19
    https://github.com/eve0415/tanstack-start-issues-repro/blob/3d4fbf9db47a2f21cc3c72fb441bbcff9272babb/src/routes/__root.tsx#L25-L33

Your Example Website or App

https://github.com/eve0415/tanstack-start-issues-repro

Steps to Reproduce the Bug or Issue

  1. pnpm install
  2. pnpm dev
  3. Access the dev server to observe the log.
  4. Also access the files and hover the params to see the expected types

Expected behavior

The context should actually pass to the serverContext

Screenshots or Videos

No response

Platform

  • Router / Start Version: 1.132.37
  • OS: any
  • Browser: any
  • Browser Version: any
  • Bundler: vite, vite-rolldown
  • Bundler Version: 7.1.7

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions