Libraries
    Preparing search index...

    Type Alias ExtensionConfig

    ExtensionConfig: {
        [K in BuilderTypeName]?: Record<
            string,
            (this: BuilderMap[K], ...args: any[]) => any,
        >
    }

    Defines the shape of an extension configuration object passed to defineExtension.

    Each key is a builder type name — one of "string", "number", "boolean", "date", "object", "array", "union", "func", or "any". The value is a record of method implementations to add to that builder type.

    Method implementations receive this bound to the target builder instance (e.g. StringSchemaBuilder for the "string" key) and must return a builder of the same type to support fluent chaining.

    Extension methods that only add validators/preprocessors do not need to call this.withExtension() — the system will auto-attach metadata using the method name as the key and the arguments as the value. Call this.withExtension(key, value) explicitly only when you need custom metadata (e.g. a transformed value or a different key).

    // Minimal extension config — auto-inferred metadata
    const config: ExtensionConfig = {
    string: {
    slug(this: StringSchemaBuilder) {
    return this.addValidator((v) => ({ valid: /^[a-z0-9-]+$/.test(v), errors: [] }));
    }
    },
    number: {
    port(this: NumberSchemaBuilder) {
    return this.isInteger().min(1).max(65535);
    }
    }
    };