I am using Parse Server and Parse JS SDK to develop an application. I recently started using typescript for my project. The question is, Can I define field types for Parse Objects?
For example, I have defined a Parse object for a post, and I want it to have a title
field of type string
const Post = Parse.Object.extend("Post");
First of all I don’t understand why the type of Post
is any
Secondly, I want the following code to throw an error or warning:
const post = new Post();
post.set("title", 123) // title should be a string and not a number
How can I do this?
Thanks
I have searched parse github and the internet for hours and found nothing.
I have tried experimenting with the second and third argument of the extend
function. But I couldn’t figure it out. I don’t know if it is related to what I am trying to do or not.