Racks
DTDrizzle Team
•Created by ewilliam on 8/12/2023 in #help
how to type dynamic where condition
You can make it more generic like this:
10 replies
DTDrizzle Team
•Created by ewilliam on 8/12/2023 in #help
how to type dynamic where condition
What it's doing is using TypeScript to lookup the type of db, then get the type of query.events.findFirst function's first argument.
I couldn't figure out how to get access to the "where" key in the first argument without using type-fest. But type-fest is a type's only library and adds no bloat to bundles.
10 replies
DTDrizzle Team
•Created by ewilliam on 8/12/2023 in #help
how to type dynamic where condition
I'm actually going to use this in some of my stuff too… it is fantastic
10 replies
DTDrizzle Team
•Created by ewilliam on 8/12/2023 in #help
how to type dynamic where condition
Yea it does work 🙂
10 replies
DTDrizzle Team
•Created by ewilliam on 8/12/2023 in #help
how to type dynamic where condition
@ewilliam you'll need to add
npm install --save type-fest
But this may work:
10 replies
DTDrizzle Team
•Created by ewilliam on 8/12/2023 in #help
how to type dynamic where condition
I think the idea is that you wouldn't bother wrapping the db.query.events.findFirst function. The type system can probably accomplish this but whats some examples of the condition(s) that will be passed in?
10 replies