get-convex / convex-helpers

A collection of useful code to complement the official packages.
MIT License
94 stars 16 forks source link

Add CustomCtx type helper #54

Closed xixixao closed 9 months ago

xixixao commented 9 months ago

I'm not sure how to test this exactly in this repo, but I tested it in mine and it works.

In my file with custom functions I can now do:

export const queryFoo = customQuery(
  baseQuery,
  customCtx(async (ctx) => {
    return {
      /// some customization....
    };
  })
);

export type QueryFooCtx = CustomCtx<typeof query>;