Some prototypes using Typescript's string manipulation.
const userId = 1;
const result = sql(
"select user.name as name, account.email as email from user",
"left join account on account.user_id = user.id",
`where user.id = ${userId}`
);
console.log(result.name, result.email); // no errors
console.log(result.id); // error
- String templates can't be used (see this issue)
- Performance will be terrible in large codebases