Property 'x' does not exist on type Ref #776
Replies: 2 comments 4 replies
-
you are using the wrong type, it is
you need to use typeguards, because a reference can be multiple types read Reference other Classes: Population or API: typeguards: isDocument & isDocumentArray PS: in case you are not on typegoose 10, you maybe need to shadow class YourClass {
public _id?: mongoose.Types.ObjectId; // dont forget to NOT put a "@prop" decorator on this, otherwise you will be overwriting all defaults
} |
Beta Was this translation helpful? Give feedback.
-
@hasezoey I am on typegoose 10. I am still getting an error TS2339: Property '_id' does not exist on type User. If I shadow _id like you mentioned it works. |
Beta Was this translation helpful? Give feedback.
-
I am getting stuck with this basic error. Need help!
I have two classes
When I map over array like
I get two errors:
For the first error do I have to do something like:
Best way to solve these errors? Thanks
Beta Was this translation helpful? Give feedback.
All reactions