TypeScript Definitions
I really like this library but why aren't you adding no typescript definitions? Typescript is very popular now and I personally am using only libs with definitions provided.
Hi @isman-usoh. I don't regularly work with TypeScript, so hadn't thought about adding it. We're very open to PRs, so if you really want this, it would be awesome if you contributed it to the project :) Beware that there's a lot of changes in master right now, so if you do this, be sure to get up-to-date with the latest changes first.
We're stabilized now, I think. So, now's the time to submit a PR!
Do you plan to start distributing the typings with the package or via the TSD/Typings definition managers?
The typings below cover the 2.0.x version:
declare module ReduxSimpleRouter {
import R = Redux;
import H = HistoryModule;
const UPDATE_LOCATION: string;
interface HistoryMiddleware extends R.Middleware {
syncHistoryToStore(store: R.Store, selectRouterState?: Function): void;
unsubscribe(): void;
}
type LocationDescriptorObject = {
pathname: H.Pathname;
search: H.QueryString;
query: H.Query;
state: H.LocationState;
};
type LocationDescriptor = LocationDescriptorObject | H.Path;
interface RouteActions {
push(nextLocation: LocationDescriptor): void;
replace(nextLocation: LocationDescriptor): void;
go(n: number): void;
goForward(): void;
goBack: void;
}
function syncHistory(history: H.History): HistoryMiddleware;
function routeReducer(): R.Reducer;
const routeActions: RouteActions;
}
declare module "redux-simple-router" {
export = ReduxSimpleRouter;
}
I think it can live in DefinitelyTyped, but if someone wants to submit it here as a PR, I can take a look at merging it. I'll close this issue and wait for a PR if anyone wants to take it on!
I'm working on this now whilst adding typescript support to my day job's project. I'm trying to get in the open source habit. Give me a few...
https://github.com/rackt/redux-simple-router/pull/204
FYI ts lint give no-internal-module error on module declaration about. Maybe consider avoiding internal module?