I am working on the react native mobile app. The mobile application uses firebase. So according to the collections and documents, I have created models. But when I receive the timestamp from firebase the MobX throws an error as follows:
at path "/details/createdAt" snapshot '{"seconds":1665659691,"nanoseconds":836000000}' is not assignable to type: 'timeModel' (Value is not a plain object), expected an instance of 'timeModel' or a snapshot like '{ seconds: number?; nanoseconds: number? }?' instead.]
Question
I am working on the react native mobile app. The mobile application uses firebase. So according to the collections and documents, I have created models. But when I receive the timestamp from firebase the MobX throws an error as follows:
at path "/details/createdAt" snapshot '{"seconds":1665659691,"nanoseconds":836000000}' is not assignable to type: 'timeModel' (Value is not a plain object), expected an instance of 'timeModel' or a snapshot like '{ seconds: number?; nanoseconds: number? }?' instead.]
To this I have created a model as follows:
Child Model
Base Model
Json starts like this:
{"createdAt": {"nanoseconds": 836000000, "seconds": 1665659691}, "createdBy":...
This throws the above error and I couldn't able think of what I went wrong! Are you guys see any problem? Thanks!