typeorm / typeorm

ORM for TypeScript and JavaScript. Supports MySQL, PostgreSQL, MariaDB, SQLite, MS SQL Server, Oracle, SAP Hana, WebSQL databases. Works in NodeJS, Browser, Ionic, Cordova and Electron platforms.
http://typeorm.io
MIT License
33.6k stars 6.22k forks source link

Switching to esnext - fields not part of "select" are returned with "undefined" #10885

Open brianzinn opened 1 month ago

brianzinn commented 1 month ago

Issue description

esnext compatibility

Expected Behavior

I was expecting switching from ES2020 to ESNext to have no impact

Actual Behavior

I am noticing that relations that are not loaded and fields that are not part of select (and are not queried - i checked the query). When the transformer applies the loaded data to an entity - it adds the extra fields unnecessarily. I am only switching the target version in my tsconfig.

Steps to reproduce

"typeorm": "^0.3.20", "sqlite3": "^5.0.2", "ts-node": "^10.8.0",

My Environment

Dependency Version
Operating System
Node.js version v18.12.1
Typescript version 5.4.5
TypeORM version 0.3.20

Additional Context

No response

Relevant Database Driver(s)

Are you willing to resolve this issue by submitting a Pull Request?

No, I don’t have the time and I’m okay to wait for the community / maintainers to resolve this issue.