Skip to content

overriding Route type when initializing UniversalRouter #185

@kleinspire

Description

@kleinspire

I'm submitting a ...

  • bug report
  • feature request
  • other (Please do not submit support requests here (below))

I'm having trouble overriding Route type when initializing UniversalRouter:

interface MyRouteType {
  customProperty: any;
}

const router = new UniversalRouter<MyContextType, MyRouteType>(routes, {
  async resolveRoute(context, params) {
    if (context.route.customProperty) {
       console.log(context.route.customProperty);
    }
  },
});

My IDE is complaining that customProperty doesn't exist on context.route

I fixed it like this: http://www.mergely.com/oC2xyDZh/, but I'm still new to typescript and I'm not sure if my fix is any good.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions