© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
Drizzle TeamDT
Drizzle Team•3y ago•
3 replies
Trey

Drizzle Typescript Init with Schema Type Error

I am testing Drizzle as an alternative to Prisma (which is our current implementation). Thanks to Drizzle's query composability it fits with some of the stuff we want to do much better.

During the process of setting up Drizzle, something is going wrong.

Looking through the docs (https://orm.drizzle.team/docs/rqb) and trying to replicate the setup is failing with a typescript error (which prevents me from accessing the
query
query
interface.

This is my current initialization:
export const db = drizzle(connection, {schema});
export const db = drizzle(connection, {schema});

schema
schema
is imported as per the documentation:
import { drizzle } from "drizzle-orm/mysql2";
import mysql from "mysql2/promise";
import * as schema from "./schema";
import { drizzle } from "drizzle-orm/mysql2";
import mysql from "mysql2/promise";
import * as schema from "./schema";

And the schema file being referenced is generated via introspection from
drizzle-kit
drizzle-kit
.

The typescript error that comes out of it is odd:
Type 'typeof import(".../db/schema")' is not assignable to type 'Record<string, never>'.
Type 'typeof import(".../db/schema")' is not assignable to type 'Record<string, never>'.

I've looked through the types, I'm not 100% sure how to correct it. As far as I can tell it's matching the documentation for
query
query
.

Have I done something silly?
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

drizzle schema type error
Drizzle TeamDTDrizzle Team / help
2y ago
Type error when passing schema to drizzle
Drizzle TeamDTDrizzle Team / help
3y ago
TypeScript Error: Circular Reference in Drizzle ORM Schema
Drizzle TeamDTDrizzle Team / help
11mo ago
Type error when using `drizzle-zod` with sqlite table schema
Drizzle TeamDTDrizzle Team / help
9mo ago