Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(core): ensure propagation and change-tracking when useDefineForClassFields enabled #4434

Closed
wants to merge 0 commits into from

Conversation

B4nan
Copy link
Member

@B4nan B4nan commented Jun 8, 2023

Propagation on new entities you create via constructor are supported too, by modifying the entity class prototype, but this technique fails when useDefineForClassFields TypeScript compiler flag is enabled (which is true when targeting ES2022 or higher). You can get around this by using declare keyword in your entity definition, or by creating entity instances via em.create(), which will ensure the propagation is enabled.

Related #4216

@B4nan B4nan changed the title fix(core): ensure propagation and change-tracking when `useDefineForC… fix(core): ensure propagation and change-tracking when useDefineForClassFields enabled Jun 8, 2023
@B4nan B4nan force-pushed the useDefineForClassFields branch 2 times, most recently from f30d437 to 827458b Compare June 8, 2023 18:42
@codecov
Copy link

codecov bot commented Jun 8, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: -0.01 ⚠️

Comparison is base (75dc4ed) 99.46% compared to head (785a67c) 99.45%.

Additional details and impacted files
@@            Coverage Diff             @@
##               v6    #4434      +/-   ##
==========================================
- Coverage   99.46%   99.45%   -0.01%     
==========================================
  Files         218      218              
  Lines       14797    14934     +137     
  Branches     3416     3423       +7     
==========================================
+ Hits        14718    14853     +135     
- Misses         77       79       +2     
  Partials        2        2              
Impacted Files Coverage Δ
packages/core/src/utils/Configuration.ts 99.27% <ø> (+0.02%) ⬆️
packages/core/src/utils/ConfigurationLoader.ts 100.00% <ø> (ø)
packages/knex/src/AbstractSqlConnection.ts 100.00% <ø> (ø)
packages/core/src/entity/ArrayCollection.ts 100.00% <100.00%> (ø)
packages/core/src/entity/EntityFactory.ts 100.00% <100.00%> (ø)
packages/core/src/entity/EntityHelper.ts 98.62% <100.00%> (-1.38%) ⬇️
packages/core/src/entity/WrappedEntity.ts 100.00% <100.00%> (ø)
packages/core/src/typings.ts 100.00% <100.00%> (ø)
packages/core/src/unit-of-work/UnitOfWork.ts 99.65% <100.00%> (+<0.01%) ⬆️
packages/knex/src/AbstractSqlDriver.ts 99.82% <100.00%> (+<0.01%) ⬆️
... and 1 more

... and 33 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

B4nan added a commit that referenced this pull request Jun 9, 2023
Proper support for `useDefineForClassFields` will be introduced in v6 via #4434.

Closes #4216
@B4nan B4nan added this to the 6.0 milestone Aug 9, 2023
@B4nan B4nan closed this Sep 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant