
I am trying to get my types sorted out with the custom collection schema. I am trying to add my custom properties to Models.Document like this:
interface Picture extends Models.Document {
user_id: string,
name: string,
pic_id: string,
an: number,
descriere: string
}
And trying to use it like this:
db.listDocuments(..).documents.map((a: Picture) => {});
Except, it's not compatible: ts
Argument of type '(a: Picture) => { user_id: string; name: string; pic_id: string; an: number; descriere: string; }' is not assignable to parameter of type '(value: Document, index: number, array: Document[]) => { user_id: string; name: string; pic_id: string; an: number; descriere: string; }'.ts(2345)
What would be the solution?

I think you need to force the assertion.

type Picture = Models.Document & {
user_id: string,
name: string,
pic_id: string,
an: number,
descriere: string
}

Basically it's the same as you but with a "type"

fixed it

thanks!

👌

[SOLVED] Custom types for document attributes
Recommended threads
- appwrite cli alpine os
the appwrite cli does not work on alpine os if you install it using the recommended bash script. Maybe there is the possibility to compile it for alpine using t...
- Invalid document structure: Unknown attr...
I have an attribute, who I deleted but it still gives error saying that Invalid document structure: Unknown attribute: "financialAidAvailable". Because of which...
- Migration to new region: not so good.
We attempted to do a migration to NYC... and things didn't go well. We followed the steps (exactly) as shown in the video, updated our app with the new endpoint...
