Angelelz
DTDrizzle Team
•Created by chepracio on 11/23/2024 in #help
TS2353: Object literal may only specify known properties, and where does not exist in type
You might have a setup problem with typescript. Make sure you use
"strict": true
in your tsconfig.json25 replies
DTDrizzle Team
•Created by Pinea on 11/28/2024 in #help
Adding joins to objects
Drizzle select syntax is very similar to plain sql. The docs won’t teach you about sql. Although they’re trying to make it more beginner friendly
11 replies
DTDrizzle Team
•Created by Pinea on 11/28/2024 in #help
Adding joins to objects
Yes, you can construct the same query and with array aggregation for the same output, although you might need to do some manual mapping
11 replies
DTDrizzle Team
•Created by chepracio on 11/23/2024 in #help
TS2353: Object literal may only specify known properties, and where does not exist in type
This
25 replies
DTDrizzle Team
•Created by Pinea on 11/28/2024 in #help
Adding joins to objects
They solve similar problems with slightly different syntax, so it's entirely up to you
11 replies
DTDrizzle Team
•Created by Pinea on 11/28/2024 in #help
Adding joins to objects
Yeah, that's a great usecase for the relational query builder
11 replies
DTDrizzle Team
•Created by johtso on 11/27/2024 in #help
How to types and parsing with raw sql
Maybe include the parts that you haven't been able to use drizzle for
8 replies
DTDrizzle Team
•Created by johtso on 11/27/2024 in #help
How to types and parsing with raw sql
I think you can. What's the query that you want to type?
8 replies
DTDrizzle Team
•Created by NeonCop on 11/28/2024 in #help
Types on conditional joins
Happy thanksgiving
27 replies
DTDrizzle Team
•Created by NeonCop on 11/28/2024 in #help
Types on conditional joins
TExcludedMethods
is used to hide via types the methods that you've used already in your query when you're not using dynamic building27 replies
DTDrizzle Team
•Created by NeonCop on 11/28/2024 in #help
Types on conditional joins
Something like:
Promise<MyReturnTypeBasedOnSelectedJoins<T>>
27 replies
DTDrizzle Team
•Created by NeonCop on 11/28/2024 in #help
Types on conditional joins
I would suggest to type out the return type explicitely without depending on drizzle's internal types. Your function is already generic, then make it return the explicit type based on the
SelectedJoins
type27 replies
DTDrizzle Team
•Created by NeonCop on 11/28/2024 in #help
Types on conditional joins
If you wanted to use TypeORM or any other tomorrow, there is a lot to re-write
27 replies
DTDrizzle Team
•Created by NeonCop on 11/28/2024 in #help
Types on conditional joins
This abstraction makes your code totally dependant on the library, in this case drizzle
27 replies
DTDrizzle Team
•Created by NeonCop on 11/28/2024 in #help
Types on conditional joins
You just need to do this:
27 replies
DTDrizzle Team
•Created by NeonCop on 11/28/2024 in #help
Types on conditional joins
There is currently no way to tell typescript the the result you're returning conforms with the declared return type
27 replies
DTDrizzle Team
•Created by NeonCop on 11/28/2024 in #help
Types on conditional joins
If you go through drizzle's codebase you'll see that it's littered with a lot of
as any
for this type of issues27 replies
DTDrizzle Team
•Created by NeonCop on 11/28/2024 in #help
Types on conditional joins
I think your solution is good. Although I don't really like this type of abstractions, you already invested the time
27 replies
DTDrizzle Team
•Created by NeonCop on 11/28/2024 in #help
Types on conditional joins
Well, typescript has its limitations
27 replies