How to loop an array and based on this create a dynamic CTE but preserve type ?
But this is not optimal
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
into a string literal.string - Even if your strings had string literal types, you couldn't loop over them
- etc.
- etc.
- etc.