Rank 2: Process
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?