Skip to content

Conversation

@Karnaukhov-kh
Copy link
Member

@Karnaukhov-kh Karnaukhov-kh commented Jun 11, 2025

update, upsert, and toDictionary functions were losing the prototype chain of objects, causing instanceof checks to fail. Spread operator was the cause of it.

Key Changes:

  • Prototype Preservation: Replaced the use of the spread operator with Object.create and Object.assign to preserver prototype chain.
  • Unit Tests: Added unit tests in update.spec.ts, upsert.spec.ts, and toDictionary.spec.ts to verify that class instances maintain the prototype after transform.

Closes #1480

@github-actions github-actions bot added 🛂 Test Unit tests, e2e tests, integration tests, test coverage 🛠️ CDK CDK related labels Jun 11, 2025
@Karnaukhov-kh Karnaukhov-kh requested a review from hoebbelsB June 11, 2025 17:32
@nx-cloud
Copy link

nx-cloud bot commented Jun 11, 2025

View your CI Pipeline Execution ↗ for commit 6535da4

Command Status Duration Result
nx affected -t lint build test component-test e... ✅ Succeeded 1m 22s View ↗
nx build docs ✅ Succeeded 50s View ↗
nx-cloud record -- npx nx format:check ✅ Succeeded 2s View ↗

☁️ Nx Cloud last updated this comment at 2025-11-06 18:32:04 UTC

@bjarne-callewaert
Copy link

@Karnaukhov-kh @hoebbelsB
Is anything blocking this PR from being merged?
If there's something I could help with, feel free to reach out

@hoebbelsB hoebbelsB merged commit 8534203 into main Nov 6, 2025
6 checks passed
@hoebbelsB hoebbelsB deleted the fix/preserve-prototype-chain branch November 6, 2025 18:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🛠️ CDK CDK related 🛂 Test Unit tests, e2e tests, integration tests, test coverage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update transformation looses typing

4 participants