Open noslouch opened 3 weeks ago
The following works without a type error as well.
await sql<{ id: number }[]>`insert into users ${sql(users)} returning id`;
My guess is that it's another case of the inferred typing problem that @porsager is trying to solve in v4.
You can get around this for the time being with an explicit casting.
await sql<{ id: number }[]>`insert into users ${sql(users, 'name', 'age') as any} returning id`;
thanks. good suggestion. of course now eslint is complaining about using any
, but I can live with that. I'd like to leave this open for posterity, in the hopes a fix lands in 4.
FWIW never
seems to work for me without complaint from ts or eslint.
Hi there. What a lovely library. I'm encountering a typing issue with dynamic inserts:
Type of 'await' operand must either be a valid promise or must not contain a callable 'then' member.
something I'm doing wrong?