drizzle-typebox infers integer() as TString

I've tried it on Github Codespaces and my machine, both times the types are inferred wrong. Is anyone else dealing with this? Here's the code:
import * as t from '@sinclair/typebox';

import { createSchemaFactory } from 'drizzle-typebox';
import { integer, pgTable, text } from 'drizzle-orm/pg-core';
import type { __String } from 'typescript';

export const contactTable = pgTable('contact', {
id: integer().primaryKey().generatedAlwaysAsIdentity(),
name: text().notNull(),
email: text(),
phone: text(),
title: text(),
});


const { createInsertSchema, createSelectSchema } = createSchemaFactory({
typeboxInstance: t,
});

const _iS = createInsertSchema(contactTable, {
email: t.String({ format: 'email' }),
});


type Test = typeof _iS.static;
import * as t from '@sinclair/typebox';

import { createSchemaFactory } from 'drizzle-typebox';
import { integer, pgTable, text } from 'drizzle-orm/pg-core';
import type { __String } from 'typescript';

export const contactTable = pgTable('contact', {
id: integer().primaryKey().generatedAlwaysAsIdentity(),
name: text().notNull(),
email: text(),
phone: text(),
title: text(),
});


const { createInsertSchema, createSelectSchema } = createSchemaFactory({
typeboxInstance: t,
});

const _iS = createInsertSchema(contactTable, {
email: t.String({ format: 'email' }),
});


type Test = typeof _iS.static;
No description
5 Replies
terrxo
terrxoOP2w ago
I've created a github issue if anyone has more information https://github.com/drizzle-team/drizzle-orm/issues/3756
GitHub
[BUG]: drizzle-typebox infers integer() as TString · Issue #3756 · ...
Report hasn't been filed before. I have verified that the bug I'm about to report hasn't been filed before. What version of drizzle-orm are you using? 0.38.1 What version of drizzle-kit...
Mario564
Mario5642w ago
This is a known issue. There's a PR with a patch for it that should be merged soon
terrxo
terrxoOP2w ago
Could you link me to the issue please? 🙏
Mario564
Mario5642w ago
GitHub
Fix drizzle-zod and drizzle-typebox mapping refinements incorre...
Addresses #3735, #3756 & #3734. Title. Also removed some unnecessary @internal JSDoc comments.
terrxo
terrxoOP2w ago
Thank you
Want results from more Discord servers?
Add your server