The HistoryState interface is an interface exported by the history package that describes the shape of the state object that can be used in conjunction with the history package and the window.location API.
You can extend this interface to add additional properties to the state object across your application.
// src/main.tsx
declare module '@tanstack/react-router' {
// ...
interface HistoryState {
additionalRequiredProperty: number
additionalProperty?: string
}
}
// src/main.tsx
declare module '@tanstack/react-router' {
// ...
interface HistoryState {
additionalRequiredProperty: number
additionalProperty?: string
}
}
Your weekly dose of JavaScript news. Delivered every Monday to over 100,000 devs, for free.