nartc / mapper

🔥 An Object-Object AutoMapper for TypeScript 🔥
https://automapperts.netlify.app/
MIT License
985 stars 87 forks source link

Cannot use string or symbol as ModelIdentifier #613

Closed timonmasberg closed 7 months ago

timonmasberg commented 7 months ago

Is there an existing issue for this?

Describe the issue

When using a string or a symbol as a model identifier, the getMetadataList will fail. It will definitely call Reflect.getMetadata which throws for non-object targets. Since it gets called with the Symbol/String as a target, the IsObject check will fail in the reflect-metadata package.

Models/DTOs/VMs

No response

Mapping configuration

No response

Steps to reproduce

Create a mapping configuration with a symbol or string as model identifier.

Expected behavior

If the identifier is a string or a symbol, no metadata should be expected. It just acts as an identifier.

Screenshots

No response

Minimum reproduction code

No response

Package

Other package and its version

No response

AutoMapper version

8.8.1

Additional context

No response