divramod
divramod
Explore posts from servers
TtRPC
Created by divramod on 10/4/2024 in #❓-help
generate types and publish them in a npm package
hey hey, i am a trpc beginner. i was able to get trpc running in a nx monorepo. now i need to publish my trpc router types as a npm package, so that it can be installed and consumed via npm in another one of our projects. could someone help me finding out the command to generate the types? or is there a guide somewhere? greetings arvid
1 replies
DTDrizzle Team
Created by divramod on 8/9/2024 in #help
how to infer the type of the db for the postgres driver
hey hey, i am just starting to use drizzle. i really like it! i want to pass the db to another function to avoid the need to recreate it, for that i need to know the type of the db const. can anyone tell me, how to infer it?
export const myFunction = async (
db: ???
): Promise<{ success: boolean}> => {
// do something with db
}
export const myFunction = async (
db: ???
): Promise<{ success: boolean}> => {
// do something with db
}
my question is, how i can infer the type of db for the following code
import {
ScraperRunFailReason,
ScraperRunStatus,
pgPool,
schema,
} from '@mylib'

const db: ??? = drizzle(pgPool, { schema })
await myFunction(db)
import {
ScraperRunFailReason,
ScraperRunStatus,
pgPool,
schema,
} from '@mylib'

const db: ??? = drizzle(pgPool, { schema })
await myFunction(db)
3 replies