cenuijza
DTDrizzle Team
•Created by ossuboi on 10/2/2024 in #help
Typing issue - findFirst/findMany `with` parameter with a dynamic value
You could do some function 'overloading' for the different return types, something along the line of
3 replies
DTDrizzle Team
•Created by ossuboi on 10/2/2024 in #help
Typing issue - findFirst/findMany `with` parameter with a dynamic value
When dealing with union types where one type is a subtype of another, TypeScript simplifies the return type to the more general type. So
findWorkById
will just have a return type of
So, if you want it to return a union type, I guess you have to explicitly mark the return type of findWorkById
. Or you would have to return some sort of discriminated union ... make the return types different enough so that one is not a subset of the other, then the inferred return type will be a union type.3 replies
DTDrizzle Team
•Created by codelilac on 6/24/2024 in #help
Struggling to use Zod with Drizzle... Type errors around |undefined
Ah I see ... I don't have that flag
8 replies
DTDrizzle Team
•Created by codelilac on 6/24/2024 in #help
Struggling to use Zod with Drizzle... Type errors around |undefined
The error says
Argument of type 'unknown' is not assignable to parameter of type '{ name ...
, so somehow TS thinks that your parsedRequest
variable has type unknown
8 replies
DTDrizzle Team
•Created by codelilac on 6/24/2024 in #help
Struggling to use Zod with Drizzle... Type errors around |undefined
Dunno, I tried your schema and it works just fine.
gives me no TS errors.
The only way I can get the same TS error as you is if somehow
parsedRequest
has unknown type ... e.g.
I don't know how that would happen, unless VSCode is confused, in which case I would restart the TS language server (or just VSCode)8 replies
DTDrizzle Team
•Created by nEEk on 8/30/2023 in #help
How can I create a virtual table with sqlite?
Maybe you can declare it as an existing view? I don't really know ...
https://orm.drizzle.team/docs/views#declaring-existing-views
13 replies