Libraries v5.0.0
    Preparing search index...

    Class Mapper<TFromSchema, TToSchema, TUnmapped, TRegistered, TAsyncRegistered, TSteps>

    A fluent builder for configuring how each target property is populated from a source schema. Uses PropertyDescriptors as pointers to properties (similar to expressions in C# .NET).

    The TUnmapped type parameter tracks which target properties have not yet been mapped or ignored. getMapper() is only callable (without arguments) when TUnmapped is never — i.e. all properties have been accounted for. If any property is missing, TypeScript will produce a compile-time type error (a type-assignability mismatch that includes the unmapped property names in its type parameters).

    Type Parameters

    • TFromSchema extends ObjectSchemaBuilder<any, any, any, any, any, any, any>

      source ObjectSchemaBuilder

    • TToSchema extends ObjectSchemaBuilder<any, any, any, any, any, any, any>

      target ObjectSchemaBuilder

    • TUnmapped extends string = SchemaKeys<TToSchema>

      union of target property key names not yet mapped

    • TRegistered = never
    • TAsyncRegistered = never
    • TSteps = {}
    Index
    "[SYMBOL_STEPS]": TSteps

    Tracks final per-property computations without executing them.

    "[SYMBOL_UNMAPPED]": TUnmapped

    Phantom property for structural type-checking of TUnmapped.

    • Returns the configured async mapping function.

      Compile-time safety: This method is only callable without arguments when all target properties have been mapped or explicitly ignored. If any property is unmapped, TypeScript will require a string argument describing the unmapped properties, producing a clear compile-time error.

      Runtime safety: Even if TypeScript checks are bypassed (e.g. via as any), a MapperConfigurationError is thrown at runtime listing the unmapped properties.

      Parameters

      • ..._args: [TUnmapped] extends [never] ? [] : [error: `Unmapped properties: ${TUnmapped}`]

      Returns SchemaToSchemaMapperResult<TFromSchema, TToSchema>