• Helper to define static methods with properly typed this context.

    This is a zero-cost abstraction - at runtime it just returns the methods object. At compile-time, it provides TypeScript with ThisType<InferConstructor & Methods> so that this inside your methods is correctly typed as the model constructor.

    Type Parameters

    Parameters

    Returns Methods

    The methods object with preserved typing

    const reviewStaticMethods = defineStaticMethods(reviewManifest, {
    async create(this: ReviewModel, data: ReviewInputObject) {
    // `this` is fully typed as ReviewModel
    const thing = await this.findOrCreateThing(data);
    return this.createFirstRevision(...);
    }
    });