JakeFenley / koa-zod-router

Build typesafe routes for Koa with ease. Utilizes Typescript, Zod, and Koa-Router to provide an easy solution to I/O validation and type inference.
MIT License
57 stars 3 forks source link

Exported variable ... has or is using name 'ZodContext' from external module #9

Closed eigBabcock closed 1 year ago

eigBabcock commented 1 year ago

Tried using the example for pulling in routes from a different file but get an error Exported variable 'routeMe' has or is using name 'ZodContext' from external module ".../node_modules/.pnpm/koa-zod-router@1.0.3_6qvceonjeialq36lgrl7dj2ju4/node_modules/koa-zod-router/dist/index" but cannot be named.

Sample code:

// routeMe.ts
export const routeMe= createRouteSpec({
  name: 'route-me',
  method: 'get',
  path: '/route-me',
  handler: handleRouteMe,
  validate: {
    body: RouteMeRequestBodySchema,
    response: RouteMeResponseSchema,
  },
})
// index.ts
router.register(routeMe)

When I use createRouteSpec in my index.ts file everything works, but I would much rather have my routes defined elsewhere.

Package Manager: pnpm Using version 1.0.3 Project is ESM All peer dependencies met

JakeFenley commented 1 year ago

Hi @eigBabcock can you do me a favor and pnpm install koa-zod-router@latest for me please? I think this should fix your issue 🤞