1 Reply
Type 'keyof ExtractTablesWithRelations<TSchema>' cannot be used to index type 'TSchema extends Record<string, never> ? DrizzleTypeError<"Seems like the schema generic is missing - did you forget to add it to your DB type?"> : { [K in keyof ExtractTablesWithRelations<...>]: RelationalQueryBuilder<...>; }'.ts(2536)
(property) PgDatabase<NeonHttpQueryResultHKT, TSchema, ExtractTablesWithRelations<TSchema>>.query: TSchema extends Record<string, never> ? DrizzleTypeError<"Seems like the schema generic is missing - did you forget to add it to your DB type?"> : { [K in keyof ExtractTablesWithRelations<...>]: RelationalQueryBuilder<...>; }
I'm trying to set up an external package to call a generic function to use findMany and findFirst just by passing schema and table name as string. I can only seem to get it to work internally if I use my schema's type, but I want it to be inferred
how am I supposed to type this ?
It's correctly inferring table names for the table parameter perfectly, but the db.query is yelling