5 ms·
@jbaudanza sorry my response actually didn't reflect your suggestion at all! Yeah I would love that sort of tool! I think theres some magic you can do with the
by yasserf 5y ago
@jbaudanza sorry my response actually didn't reflect your suggestion at all!
Yeah I would love that sort of tool! I think theres some magic you can do with the es6 templating parsing, but that would be a bit complex to do as a supporting library
- jbaudanza 5y agoNo worries! I enjoyed checkout out your implementation! I think such a tool would be complicated to implemented. I was thinking maybe of integrating with tagged template literals somehow. Maybe something like: db.query(sql`SELECT COUNT(*) FROM users`) And then some tool could parse the AST to find all the SQL and generate types.
- deleted 5y ago[deleted]
- guntars 5y agoHow about keeping the query as a separate, importable .sql file that can be analyzed by a tool and it could spit out the typings to a .sql.d.ts file? The editor support for mixing languages in a single file was not great, last time I checked.