
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
- Problems with adding my custom domain
- CSV Not Importing
We don’t seem to having any luck importing a simple .csv file. The import function acts like it’s working but no data imports or is shown in the collection The...
- Can't push functions when self-hosting o...
Hello, I'm a bit new to appwrite functions and recently hosted a fresh 1.7.4 on my portainer setup. Tried to create a new function and when trying to push it I ...
