Stack Exchange
Create function for constructor of generic class
Consider this:
export class Method<TBody extends Body = Body, TResponse extends Response = Response, TQuery extends z.Shape = z.Shape> {
  constructor(
    readonly method: "GET" | "POST" | "PUT" | "DELETE",
    readonly options: {
      readonly summary?: string;
      readonly query?: TQuery;
      readonly body?: TBody;
      readonly response: TResponse;
    },
  ) {}
}

How can I create a factory function without specifying all generic types again?
export function method<T extends any[]>(...args: T) {
  return new Method(...args);
}


You could use the helper type ConstructorParameters:
export function method(...args: ConstructorParameters<typeof Method>): Method {
  return new Method(...args);
}


That doesn’t expose the generics of Method

Oh OK I misunderstood your question, well you can't do that
