ApexFossa45
WWasp-lang
•Created by ApexFossa45 on 11/6/2024 in #đŸ™‹questions
Object literal may only specify known properties
Hi, having an issue where calling an operation to create user comments doesn't work due to issues with typescript.
I currently have this as the function definition
export const createComment: CreateComment = async ({ fileId, content }, context: any) => {
// code to create user comments here given a fileId and the content
})
Where I also set the type for CreateComment as:
type CreateComment = (args: { fileId: string; content: string }, context: any) => Promise<CommentWithUser>;
type CommentWithUser = Comment & {
user: {
id: string;
username: string;
};
};
and extra note is the main.wasp has the correct definition:
action createComment {
fn: import createComment from "@src/featured-creations/operations",
entities: [Comment, User, File],
}
--
My question is, why is it giving me type errors, when I have both, the fileId, and the content, defined as arguments within the CreateComment type as shown above?
[ Wasp ] ext-src/featured-creations/FeaturedCreationsPage.tsx(65,56): error TS2353: Object literal may only specify known properties, and 'content' does not exist in type '{ fileId: string; }'.
I tried running wasp clean to see if it was an issue with outdated build files but to no success.
Appreciate any assistance
Thanks,
Apex
27 replies