Flarum (v2.0.2)
    Preparing search index...

    Implements

    Index
    • Add a mithril route to the application.

      Parameters

      • name: string

        The name of the route.

      • path: `/${string}`

        The path of the route.

      • component: NewComponent<any> | AsyncNewComponent<any>

        must extend Page component.

      • OptionalresolverClass: new (
            component: NewComponent<any> | AsyncNewComponent<any>,
            routeName: string,
        ) => DefaultResolver<any, any, any>

        An optional custom route resolver class.

        resolverClass is spelled as a construct signature rather than as typeof DefaultResolver, and has to be. A resolver that narrows the component it accepts -- which is the only reason to write one, and what both of core's own do -- is not assignable to typeof DefaultResolver, because constructor parameters are contravariant and DefaultResolver's are open. This matches the resolverClass field on RouteItem, which is where the value is being put.

      Returns Routes