The boilerplate code in server entry point docs is giving type error
Open
Beginner friendly
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 15.1k
- Forks
- 1.9k
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 143
Description
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
- bootstrap a new tanstack app
pnpm dlx @tanstack/cli@latest create - create src/server.ts file
- copy paste the code from docs
Expected behavior
The types should be inferred and shouldn't show an error
Screenshots or Videos
Platform
- Router / Start Version: 1.169.2
- OS: macOS
- Bundler: vite
- Bundler Version: 8.0.12
Additional context
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the Server Entry Point TanStack Start docs page and reproduce the snippet in the linked minimal reproducer's src/server.ts. Check the createServerEntry and handler.fetch types in the stated setup; done when the documented example type-checks without errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100