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
- One org lost all data out of 13 org's af...
> https://<domain>/v1/storage/buckets?queries%5B0%5D=%7B%22method%22%3A%22limit%22%2C%22values%22%3A%5B6%5D%7D&queries%5B1%5D=%7B%22method%22%3A%22offset%22%2C%...
- database documents relationships
after migrating from 1.7.4 to 1.8, database get document and list documents is getting results but with no relationship values, the relationship attribute will...
- deployment on every remote branch leads ...
Hi there, on my local appwrite instance it rebuilds my site on every deployment i make to github on every branch, even the main branch is set in the site settin...