Im using typescript in the cloud code of my parse server but Im getting some problems saving and getting objects.
In the main.js file I have registered the next class:
Parse.Object.registerSubclass('Subscription', Subscription);
Subscription.ts:
export class Subscription extends Parse.Object {...}
Saving a object like:
obj = new Parse.Object(Subscription)
it is going to create a class "undefined" storing there the data.
But typing obj = new Parse.Object("Subscription");
its work ok.
Any idea? Thanks!
When using classes extending Parse.Object, you'll need to create new instances of those objects directly:
export class Subscription extends Parse.Object {
constructor() {
// Pass the ClassName to the Parse.Object constructor
super('Subscription');
}
}
However, when using extends, the SDK is not automatically aware of your subclass. If you want objects returned from queries to use your subclass of Parse.Object, you will need to register the subclass, similar to what we do on other platforms.
// After specifying the Subscription subclass...
Parse.Object.registerSubclass('Subscription', Subscription);
See http://docs.parseplatform.org/js/guide/#objects for more informations