frontarm / navi

🧭 Declarative, asynchronous routing for React.
https://frontarm.com/navi/
MIT License
2.07k stars 71 forks source link

Help with types #128

Closed lookfirst closed 5 years ago

lookfirst commented 5 years ago

Apologies, I know this is an issue tracker, but I didn't immediately see a way to ask a question. Plus, this discussion might help others.

const authSection = (authRoute: any) => compose(
    withView((_, context: RoutingContext) => (
        <MainLayout user={context.currentUser}/>
    )),
    compose(
        withView(
            <>
                <AuthenticationHeader/>
                <MainWithView/>
            </>
        ),
        authRoute
    )
);

authRoute is this...

export default route({
    getView: () => {
        return (<Users/>);
    },
    title: 'Authentication - Users',
});

What type should I use for the any in authSection? If I don't use any there, I get the usual implicityany error.

jamesknelson commented 5 years ago

I think you want Matcher<RoutingContext>.

lookfirst commented 5 years ago

Perfect, thanks!