© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
Drizzle TeamDT
Drizzle Team•3y ago•
1 reply
Droutin

Nuxt3 type error

Hello, is there somebody who used Drizzle in Nuxt3 project?
I have problem with inheriting types from api, but only when I select specific columns from db. Server-side code shows correct types. Problem is on client-side, like you can see on photo. It gives mi correct type OR default type...

Server-side
import { sql } from "drizzle-orm";
import { clientSchema } from "~/server/schemas/clientSchema";
import { projectSchema } from "~/server/schemas/projectSchema";
import { drizzle } from "~/server/services/drizzle";
import { eq } from "drizzle-orm/expressions";

export default defineEventHandler(async () => {
    const projects = await drizzle
        .select({
            id: projectSchema.id,
            name: projectSchema.name,
            tariff: projectSchema.tariff,
            client: {
                id: clientSchema.id,
                name: clientSchema.name,
            },
        })
        .from(projectSchema)
        .leftJoin(clientSchema, eq(clientSchema.id, projectSchema.clientId))
        .where(sql`${projectSchema.deletedAt} IS NULL`);
    return projects;
});
import { sql } from "drizzle-orm";
import { clientSchema } from "~/server/schemas/clientSchema";
import { projectSchema } from "~/server/schemas/projectSchema";
import { drizzle } from "~/server/services/drizzle";
import { eq } from "drizzle-orm/expressions";

export default defineEventHandler(async () => {
    const projects = await drizzle
        .select({
            id: projectSchema.id,
            name: projectSchema.name,
            tariff: projectSchema.tariff,
            client: {
                id: clientSchema.id,
                name: clientSchema.name,
            },
        })
        .from(projectSchema)
        .leftJoin(clientSchema, eq(clientSchema.id, projectSchema.clientId))
        .where(sql`${projectSchema.deletedAt} IS NULL`);
    return projects;
});


Client-side
const { data: projects } = await useFetch("/api/projects/", { method: "GET" });
const { data: projects } = await useFetch("/api/projects/", { method: "GET" });
image.png
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

Type error?
Drizzle TeamDTDrizzle Team / help
3y ago
DB type error
Drizzle TeamDTDrizzle Team / help
3y ago
Type error when inserting
Drizzle TeamDTDrizzle Team / help
2y ago
drizzle schema type error
Drizzle TeamDTDrizzle Team / help
2y ago