- SDK build failed with exit code: 2
Heyy @kapa.ai
[ Wasp ] ext-src/dashboard/monthlyPlans/MonthlyPlanOperations.ts(19,32): error TS2339: Property 'map' does not exist on type 'never'.
[ Wasp ] ext-src/dashboard/monthlyPlans/MonthlyPlanPage.tsx(44,15): error TS2322: Type '(plan: MonthlyPlan & { trainingDays: TrainingDay[]; }) => void' is not assignable to type '(plan:
GetResult<{ id: number; name: string; startDate: Date; userId: string; }, unknown> & {}) => void'.
[ Wasp ] Types of parameters 'plan' and 'plan' are incompatible.
[ Wasp ] Type 'GetResult<{ id: number; name: string; startDate: Date; userId: string; }, unknown> & {}' is not assignable to type 'GetResult<{ id: number; name: string; startDate: Date; userId: string; }, unknown> & {} & { trainingDays: (GetResult<{ id: number; date: Date; workoutId: number; monthlyPlanId: number; }, unknown> & {})[]; }'.
[ Wasp ] Property 'trainingDays' is missing in type 'GetResult<{ id: number; name: string; startDate: Date; userId: string; }, unknown> & {}' but required in type '{ trainingDays:
(GetResult<{ id: number; date: Date; workoutId: number; monthlyPlanId: number; }, unknown> & {})[]; }'.
Whitout seeing code, what fixes what you propose?7 Replies
Hi @NEROX. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
Based on the error messages you've provided, it seems like there are two main issues:
1.
Property 'map' does not exist on type 'never'.
: This error usually occurs when TypeScript infers the type of a variable to be never
, which means that the variable should never occur. This could be due to a variety of reasons, such as a function that never returns (e.g., it always throws an error). Without seeing the code, it's hard to provide a specific solution, but you should check the variable or function that you're trying to call .map()
on and make sure it's correctly typed and initialized.
2. Type 'GetResult<{ id: number; name: string; startDate: Date; userId: string; }, unknown> & {}' is not assignable to type 'GetResult<{ id: number; name: string; startDate: Date; userId: string; }, unknown> & {} & { trainingDays: (GetResult<{ id: number; date: Date; workoutId: number; monthlyPlanId: number; }, unknown> & {})[]; }'. Property 'trainingDays' is missing in type 'GetResult<{ id: number; name: string; startDate: Date; userId: string; }, unknown> & {}' but required in type '{ trainingDays: (GetResult<{ id: number; date: Date; workoutId: number; monthlyPlanId: number; }, unknown> & {})[]; }'.
: This error is saying that the type of the plan
parameter in your function doesn't match the expected type. Specifically, the plan
object is missing the trainingDays
property. You should ensure that the plan
object includes this property, and that it's of the correct type.
Please note that these are general suggestions based on the error messages, and the specific solutions may vary depending on your code. If you're still having trouble, I would recommend checking the TypeScript documentation or seeking help from the Wasp community.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Sorry @NEROX, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist:
Perhaps try again in 15mins?@NEROX that's a typescript error π You need to have proper typing on the array - it's probably initialising as an empty array without you specifying what is going to be in it
@CamBlackwood I am working with VSCode in W10/WSL, I have heard about Cursor or something similar but I didn't understand very well...
Do you think with any of them I could avoid using Kapa as pair programmer?
I think I have more typescript errors that wasp or prisma errors...
Typescript is tricky π I think of course it's a good idea to read about the language itself a bit (I recommend Matt Pocock's resources for that), but for the quick fix with AI I'd recommend feeding it with context into openai or claude.
Also, although I wouldn't recommend it, you can use plain javascript instead, especially if this isn't a large scale project.
I recommended cursor -
https://discord.com/channels/686873244791210014/916285649269690389/1281242134011449354 It's posted in the main chat - it's great. Would be good to have wasp related problems in the discord and ask cursor for typescript problems. Use Claude for the best response
https://discord.com/channels/686873244791210014/916285649269690389/1281242134011449354 It's posted in the main chat - it's great. Would be good to have wasp related problems in the discord and ask cursor for typescript problems. Use Claude for the best response
With Claude alone (and the wasp docs), I have managed to solve it. I have already installed Cursor, passed the Docs so now I will play with it!:boi:
Nice! I'm happy to see everyone come together in a thread π