react-router
react-router copied to clipboard
[Docs]: Using Middleware in Data Mode requires module augmentation
Describe what's incorrect/missing in the documentation
This is not mentioned in the docs, but in order for context in loaders not to be any, the Future interface in react-router needs to be augmented:
declare module 'react-router' {
interface Future {
v8_middleware: true;
}
}
I don't think there's a way around this, so my proposal is to add this to usage with Data Mode.
I found that if I type my middleware functions as MiddlewareFunction<RouterContextProvider> it helps
Unfortunately that doesn't help in my case, RouterContextProvider is already the default value.