Libraries
    Preparing search index...

    Type Alias FixedMethods<TRawMethods, TBase, TAccum, TExtraTypes>

    FixedMethods: {
        [K in keyof TRawMethods]: TRawMethods[K] extends (
            this: any,
            ...args: infer A,
        ) => infer R
            ? R extends { __cleverbrush_extra_type_brand__?: any }
                ? <const TName extends string & A[0], const TKey extends string>(
                    name: TName,
                    ...columns: ReadonlyArray<
                        | TKey
                        | (
                            TBase extends ObjectSchemaBuilder<any, any, any, any, any>
                                ? (t: PropertyDescriptorTree<TBase, TBase>) => any
                                : (t: any) => any
                        ),
                    >,
                ) => TBase & FixedMethods<
                    TRawMethods,
                    TBase,
                    TAccum,
                    TExtraTypes & Record<TName, readonly TKey[]>,
                > & HiddenExtensionMethods & {
                    __cleverbrush_extra_type_brand__?: TExtraTypes & Record<
                        TName,
                        readonly TKey[],
                    >;
                } & (
                    [TAccum] extends [never]
                        ? {}
                        : { __cleverbrush_method_literal_brand__?: TAccum }
                )
                : R extends { __cleverbrush_method_literal_brand__?: any }
                    ? <const TName extends string & A[0]>(
                        name: TName,
                        ...rest: TailArgs<A>,
                    ) => TBase & FixedMethods<
                        TRawMethods,
                        TBase,
                        TAccum
                        | TName,
                        TExtraTypes,
                    > & HiddenExtensionMethods & {
                        __cleverbrush_method_literal_brand__?: TAccum | TName;
                    } & (
                        [keyof TExtraTypes] extends [never]
                            ? {}
                            : { __cleverbrush_extra_type_brand__?: TExtraTypes }
                    )
                    : (
                        ...args: A,
                    ) => TBase & FixedMethods<TRawMethods, TBase, TAccum, TExtraTypes> & HiddenExtensionMethods & (
                        [TAccum] extends [never]
                            ? {}
                            : { __cleverbrush_method_literal_brand__?: TAccum }
                    ) & (
                        [keyof TExtraTypes] extends [never]
                            ? {}
                            : { __cleverbrush_extra_type_brand__?: TExtraTypes }
                    )
            : TRawMethods[K]
    }

    Overrides extension method return types so they always return the full extended builder type. This ensures extension methods preserve all other extension methods through chaining (e.g. s.string().email().slug()).

    The self-reference (FixedMethods appears in its own mapped return types) is resolved lazily by TypeScript because the recursion sits inside a function-return position within a conditional mapped type.

    The optional third parameter TAccum accumulates literal string names registered by methods whose raw return type includes { readonly [METHOD_LITERAL_BRAND]?: any }. Those methods are rewritten as const-generic so the literal flows through; all other methods thread the accumulator unchanged.

    The optional fourth parameter TExtraTypes accumulates a Record<name, readonly string[]> map contributed by methods whose raw return type includes { readonly [EXTRA_TYPE_BRAND]?: any }. Those methods are rewritten as const-generic for both the name and the keys tuple so the mapping flows through; all other methods thread it unchanged.

    For object-schema methods the accessor-form callback parameter is automatically typed as PropertyDescriptorTree<TBase, TBase> when TBase is an ObjectSchemaBuilder, giving callers IDE autocomplete over the schema's own properties.

    Type Parameters

    • TRawMethods
    • TBase
    • TAccum extends string = never
    • TExtraTypes extends Record<string, readonly string[]> = Record<never, never>