fix: Parse.Object.createWithoutData doesn't preserve object subclass - #2907
Conversation
|
🚀 Thanks for opening this pull request! |
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
📝 WalkthroughWalkthroughChanged the static ParseObject.createWithoutData signature to a generic form using a this-type parameter so calls return the specific subclass type; corresponding typings and type-test declarations were updated. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested reviewers
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
I will reformat the title to use the proper commit message syntax. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## alpha #2907 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 64 64
Lines 6235 6235
Branches 1477 1493 +16
=========================================
Hits 6235 6235 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@types/tests.ts`:
- Around line 45-52: Fix the typo in the test comment by changing
"createWitoutData" to "createWithoutData" so the comment matches the actual
method name used in the assertions; update the comment that precedes
Game.createWithoutData / GameScore.createWithoutData /
Parse.User.createWithoutData to use the correct spelling "createWithoutData".
…se-SDK-JS into fix-createWithoutData
Parse.Object.createWithoutData doesn't preserve class of invoking object
Parse.Object.createWithoutData doesn't preserve class of invoking objectParse.Object.createWithoutData doesn't preserve class type of invoking object
Parse.Object.createWithoutData doesn't preserve class type of invoking objectParse.Object.createWithoutData doesn't preserve instance type of object class
Parse.Object.createWithoutData doesn't preserve instance type of object classParse.Object.createWithoutData doesn't preserve object subclass
## [8.1.1-alpha.2](8.1.1-alpha.1...8.1.1-alpha.2) (2026-02-07) ### Bug Fixes * `Parse.Object.createWithoutData` doesn't preserve object subclass ([#2907](#2907)) ([01dc94d](01dc94d))
|
🎉 This change has been released in version 8.1.1-alpha.2 |
# [8.2.0](8.1.0...8.2.0) (2026-02-20) ### Bug Fixes * `Parse.Object.createWithoutData` doesn't preserve object subclass ([#2907](#2907)) ([01dc94d](01dc94d)) * `Parse.Query.and/or/nor` loosing custom class types ([#2903](#2903)) ([89fdb07](89fdb07)) * `Parse.serverURL` not accessible via global `Parse` scope ([#2917](#2917)) ([4e78681](4e78681)) * Cloud trigger type errors for void returns and subclass constructors ([#2904](#2904)) ([de9f56d](de9f56d)) * Missing or incorrect type exports ([#2909](#2909)) ([3caa4ec](3caa4ec)) * Type error in `Parse.Query.equalTo` when matching optional array ([#2901](#2901)) ([8c96da9](8c96da9)) ### Features * Add request header `X-Parse-Upload-Mode` to identify file upload as binary data via `Buffer`, `Readable`, `ReadableStream` ([#2927](#2927)) ([a66bb06](a66bb06)) * Add support for file upload as binary data via `Buffer`, `Readable`, `ReadableStream` ([#2925](#2925)) ([e42caf6](e42caf6))
|
🎉 This change has been released in version 8.2.0 |
Pull Request
Issue
This was originally already an issue with the original DefinitelyTyped typings, but with the new built-in typings the issue has expanded beyond the original scope.
Problem :
createWithoutDatacalls on Parse.Object subclasses return object instances of that specific class. However, the current typings lose this connection and instead reverts to a generic Parse.Object type. Originally with the DefinitelyTyped typings this issue affected all user-defined classes, but at least Parse.User wasn't affected since it had its own separate typings. However, with our definition of ParseUser now extending from ParseObject, this version's Parse.User is also affected by this issue.Approach
Added generic typing argument to
createWithoutData. (thisonly affects TS typings, JS and usage wise it is still a single argument method)Tasks
Summary by CodeRabbit