You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
context returned from server middleware is incorrectly typed as undefined only in Solid Start #7092
The type of the context object which has passed through server middleware is incorrectly inferred as undefined. When I log out the context object, it does actually have the fields I would expect from the middleware, they're just missing from the type.
The context object comes from route middleware in a parent route and is accessed in a child route's server handler. I'm not sure if that's relevant, though. Adding the middleware array directly to the child route's middlleware array also does not correctly set the type on context, it's still typed as undefined. I've added an example in my reproduction to show this.
It seems like the issue is limited to Solid Start. I've recreated the same routes and middleware in React Start and the types are properly inferred. I've included this example in my reproduction for reference.
Run npx tsc and see that context is typed as 'undefined'
Start the local dev server and visit http://localhost:3000/api/public/example. You should see a stringified context object which does have the supportsGzip field
Step to the repo's root level and then into the react-working folder
Run npx tsc and see that context is not typed as 'undefined' despite getting created and accessed in the same way
Expected behavior
I would expect the type of context to be inferred from the shape of the data returned under the context field from my middleware chain instead of undefined. This is the result I see in React Start, but not Solid Start.
When I compare the type signatures on the GET server handler in the nested route, it does appear that the context's type is in there, but it's slightly different between the two frameworks 👀
React has the request's middleware type in a tuple ([RequestMiddlewareAfterServer<{}, undefined, { supportsGzip: boolean; }>]) whereas Solid has it in an array in the same place (RequestMiddlewareAfterServer<{}, undefined, { supportsGzip: boolean; }>[])
Activity
njGroters commentedon Apr 3, 2026
When I compare the type signatures on the
GETserver handler in the nested route, it does appear that thecontext's type is in there, but it's slightly different between the two frameworks 👀React has the request's middleware type in a tuple (
[RequestMiddlewareAfterServer<{}, undefined, { supportsGzip: boolean; }>]) whereas Solid has it in an array in the same place (RequestMiddlewareAfterServer<{}, undefined, { supportsGzip: boolean; }>[])Full React type
Full Solid type