Hi there,
While coding, I noticed that createDocument doesn't provide product key suggestions in the data argument. According to your type definitions, it seems like it should suggest keys, but it doesn't.
Here's the code I was trying:
await databases.createDocument<Product>(
appwriteConfig.DATABASE_ID,
appwriteConfig.PRODUCTS_COLLECTION_ID,
ID.unique(),
{},
);
Here's the Product interface I'm using:
export interface Product extends Models.Document {
name: string;
description: Description;
category: Category;
brand: Brand;
images: string[];
videoUrl: string | null;
variants: Variant[];
weight: number;
averageRating: number | null;
reviewCount: number | null;
active: boolean;
featured: boolean;
returnPolicy: ReturnPolicy;
store: Store;
}
And here’s your type for createDocument:
createDocument<Document extends Models.Document>(
databaseId: string,
collectionId: string,
documentId: string,
data: Omit<Document, keyof Models.Document>,
permissions?: string[]
): Promise<Document>;
Since Product extends Models.Document, I expected data to suggest the keys for the Product type (excluding Models.Document keys), but that doesn’t happen. Could you help clarify this? Is this a type inference issue, or am I missing something?
issue i am experiencing is related to node-appwrite version ^14.1.0
Recommended threads
- Charged after Downgrade
I downgraded from the pro plan last month, but it’s still trying to charge my card this month and my account has been restricted
- Wifi issue with Pop!_OS linux distro
Hey guys... iam facing this very peculiar trouble with my linux distro... I use Pop!_OS on my HP victus gaming laptop with nvedia 2050 graphics card.... The pro...
- Urgent Help
Hello Appwrite team, I urgently need your help. I am the founder of OnBuch, an EdTech application used by around 10,000 users in Cameroon. In the last two day...