Skip to content

TypeError can't convert undefined to object #624

Open
@JS-VG24

Description

Is there an existing issue for this?

  • I have searched the existing issues

Describe the issue

Hej there,

it seems this project is not maintained anymore, which is quite sad as I having trouble with an Issue I'm confronted with right now. I will post it anyways in the hopes there will be a fork and the Issue gets resolved there!

I have a project that uses Database Entities with Snake-Case and Dto's with Camel-Case. This worked fine until I defined multiple fields starting with the same string like:

password and password_reset_token

then all hell brakes loose and the following error is thrown:

TypeError can't convert undefined to object hasProperty@https://2vqzsn.csb.app/node_modules/ automapper/core/index.js:1120:42 getFlatteningPaths@https://2vqzsn.csb.app/node_modules/ automapper/core/index.js:1111:32 processSourcePath@https://2vqzsn.csb.app/node_modules/ automapper/core/index.js:1352:22 _loop3@https://2vqzsn.csb.app/node_modules/ automapper/core/index.js:1277:39 createInitialMapping@https://2vqzsn.csb.app/node_modules/ automapper/core/index.js:1315:17 createMap@https://2vqzsn.csb.app/node_modules/ automapper/core/index.js:1413:13

I made a simple CodeSandbox example that shows the problem and how to reproduce it.

Hopefully that will help!

Cheers
Jan

Models/DTOs/VMs

See CodeSandbox example!

Mapping configuration

See CodeSandbox example!

Steps to reproduce

See CodeSandbox example!

Expected behavior

That the naming converter does not throw an error and allows for fields starting with the same string!

Screenshots

No response

Minimum reproduction code

https://codesandbox.io/p/sandbox/naughty-rgb-2vqzsn

Package

  • I don't know.
  • @automapper/core
  • @automapper/classes
  • @automapper/nestjs
  • @automapper/pojos
  • @automapper/mikro
  • @automapper/sequelize
  • Other (see below)

Other package and its version

No response

AutoMapper version

8.8.1

Additional context

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions