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.
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 (
FixedMethodsappears 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
TAccumaccumulates literal string names registered by methods whose raw return type includes{ readonly [METHOD_LITERAL_BRAND]?: any }. Those methods are rewritten asconst-generic so the literal flows through; all other methods thread the accumulator unchanged.The optional fourth parameter
TExtraTypesaccumulates aRecord<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>whenTBaseis anObjectSchemaBuilder, giving callers IDE autocomplete over the schema's own properties.