Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Start: middleware context property type gets merged instead of overridden #2780

Open
acastroviejo opened this issue Nov 16, 2024 · 1 comment
Labels
start Everything about TanStack Start types Changes to the typescript types

Comments

@acastroviejo
Copy link

acastroviejo commented Nov 16, 2024

Which project does this relate to?

Start

Describe the bug

If I try to override a context property on a second middleware the types get merged together instead of overridden.

Your Example Website or App

https://github.com/acastroviejo/start-merge-middleware-context

Steps to Reproduce the Bug or Issue

  1. Open the ~/app/routes/index.tsx file and inspect the type of context.session (line 25)

Expected behavior

I expected the type of overridden context properties to be overridden and not merged together.

Screenshots or Videos

Image

Platform

  • OS: [e.g. macOS, Windows, Linux]
  • Browser: [e.g. Chrome, Safari, Firefox]
  • Version: [e.g. 91.1]

Additional context

A real world use case is a sessionMiddleware that uses a maybeSessionMiddleware internally updating the type of session from Session | undefined to Session, but now it stays as possibly undefined

@SeanCassiere SeanCassiere added start Everything about TanStack Start types Changes to the typescript types labels Nov 16, 2024
@SeanCassiere
Copy link
Member

cc @chorobin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
start Everything about TanStack Start types Changes to the typescript types
Projects
None yet
Development

No branches or pull requests

2 participants