Skip to content

The boilerplate code in server entry point docs is giving type error #7399

@flexdinesh

Description

@flexdinesh

Which project does this relate to?

Start

Describe the bug

The boilerplate code in the Server Entry Point TanStack Start docs page is giving type errors.

import handler, { createServerEntry } from '@tanstack/react-start/server-entry'

type MyRequestContext = {
  hello: string
  foo: number
}

declare module '@tanstack/react-start' {
  interface Register {
    server: {
      requestContext: MyRequestContext
    }
  }
}

export default createServerEntry({
  async fetch(request) {
    return handler.fetch(request, { context: { hello: 'world', foo: 123 } })
  },
})

Complete minimal reproducer

https://github.com/flexdinesh/tanstack-start-request-context-repro/blob/main/src/server.ts

Steps to Reproduce the Bug

  1. bootstrap a new tanstack app pnpm dlx @tanstack/cli@latest create
  2. create src/server.ts file
  3. copy paste the code from docs

Expected behavior

The types should be inferred and shouldn't show an error

Screenshots or Videos

Image

Platform

  • Router / Start Version: 1.169.2
  • OS: macOS
  • Bundler: vite
  • Bundler Version: 8.0.12

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions