How to loop an array and based on this create a dynamic CTE but preserve type ?
But this is not optimal
Solution:Jump to solution
It's impossible to do this while keeping the types. Not only because of Kysely but also because of typescript.
- You can't change the type of a variable in typescript.
- You can't turn a
string
into a string literal.
- Even if your strings had string literal types, you couldn't loop over them...4 Replies
Solution
It's impossible to do this while keeping the types. Not only because of Kysely but also because of typescript.
- You can't change the type of a variable in typescript.
- You can't turn a
string
into a string literal.
- Even if your strings had string literal types, you couldn't loop over them
- etc.
- etc.
- etc.ok!! so I can’t apply a reduce function to a QueryBuilder type ?
You can't change the type of a variable
If the type doesn't change, you can reduce it
ok thanks will try!! congratz on your helpful work