ยฉ 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
Drizzle TeamDT
Drizzle Teamโ€ข3y agoโ€ข
5 replies
DoronT

Get type for select query?

Hey guys, is there a way to infer the "select" type for a given table? for example:

async getUsers(selectColumns: ?) {
  return this.db.select(selectColumns).from(users)
}
async getUsers(selectColumns: ?) {
  return this.db.select(selectColumns).from(users)
}


I have a
UsersService
UsersService
class with
getUsers
getUsers
method. I want callers to be able to select specific columns.
Is is possible to achieve this type safety and autocomplete without directly using the drizzle client?
Drizzle TeamJoin
The official Discord for all Drizzle related projects, such as Drizzle ORM, Drizzle Kit, Drizzle Studio and more!
11,879Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Select query return type seems weird
Drizzle TeamDTDrizzle Team / help
14mo ago
Get type from select object ?
Drizzle TeamDTDrizzle Team / help
2y ago
Get return-type from QueryBuilder
Drizzle TeamDTDrizzle Team / help
2y ago
Type for select with relations?
Drizzle TeamDTDrizzle Team / help
3y ago