In v1.0.1 the onmatch signature was changed to only allow a Promise to be returned if it was a Promise<Component<any, any>>. I believe this is too restrictive - see the mithril docs at http://mithril.js.org/route.html#preloading-data for an example of using a Promise returned by m.request to defer rendering a component until data is loaded.
I think this is as simple as changing the onmatch signature to allow Promise<any>, like so:
In v1.0.1 the
onmatch
signature was changed to only allow aPromise
to be returned if it was aPromise<Component<any, any>>
. I believe this is too restrictive - see the mithril docs at http://mithril.js.org/route.html#preloading-data for an example of using aPromise
returned bym.request
to defer rendering a component until data is loaded.I think this is as simple as changing the
onmatch
signature to allowPromise<any>
, like so:onmatch?: (args: any, requestedPath: string) => Mithril.Component<any,any> | Promise<any> | void;
Let me know what you think. I can do it myself and raise a PR if you like.