Boosting the use of TypeScript with Electron Router DOM
Typing URLSearchParams globally
To get global typing of URLSearchParams in the get method of the queryKeys you specified, you can use the following approach using the settings object returned by the createElectronRouter function:
Or you can type all methods:
With this, you will be able to take advantage of editor's intellisense in both the global URLSearchParams object and the useSearchParams hook of the react-router-dom library.
Typing a factory with router ids and queryKeys
Assuming you have a factory to create windows in Electron, and you want to type it with the ids and queryKeys you specified in the createElectronRouter function,
you can use the following approach using the registerRoute method returned by it:
With this, when calling the createWindow function, you will have the id property and the query object properly typed.