nehalistN
tRPC3y ago
5 replies
nehalist

Type of createServerSideHelpers?

I'm currently trying to implement a helper for
getServerSideProps
to reduce duplication. It's still wip, but I'm encountering a problem I can't figure out:

export async function createServerSideProps(
  ctx: GetServerSidePropsContext,
  callback: (helpers/**: ???? */) => Record<string, any>
) {
  const helpers = createServerSideHelpers({
    router: appRouter,
    ctx: {
      user: await getServerSession(ctx.req, ctx.res, authOptions),
    },
    transformer: superjson,
  });

  const props = callback(helpers);

  return {
    props,
  };
}


What's the type of helpers in the callback?
Was this page helpful?