Open gajus opened 2 years ago
I usually get around this with aliasing const _sql = sql
, does that work? It might be tricky coming up with a reliable way to tell if a type is generated or hand-written.
What about checking for a comment in the query that would cause typegen to ignore it altogether?
What's the advantage of that over aliasing sql
? To be clear, the disadvantages in my mind are: steeper learning curve, more magic, less intuitive usage, more complex implementation.
If the only rule a user needs to remember is ”slonik-typegen affects sql
" then the escape hatch follows naturally.
hey guys, you'll be happy to hear, we're working on both of these issues ignoring queries from extraction (without renaming the literal) as well as preserving custom type enhancements.
Your feedback on both proposals is very welcome.
Related to this:
https://github.com/mmkal/slonik-tools/issues/362
I want to override types for a specific query.
Expected
I expect that if I provide a custom type to
sql
tagged template, then thentypegen
won't override it.Actual
typegen
always overridessql
types.