TS Errors in Custom Type citext example

I want to include citext data type in my postgres schemas. I was delighted to see there's a complete example in the docs (https://github.com/drizzle-team/drizzle-orm/blob/main/docs/custom-types.md#citext-data-type-example) However, it seems to be broken - see screenshot - because I'm getting a bunch of TS errors. Something on my side or is it outdated? Edit: to give a bit more context, the errors all seem to be originating, for now at least, from this error on PgColumnBuilder:
Generic type 'PgColumnBuilder<THKT, T, TRuntimeConfig, TTypeConfig>' requires between 2 and 4 type arguments.ts(2707)
Generic type 'PgColumnBuilder<THKT, T, TRuntimeConfig, TTypeConfig>' requires between 2 and 4 type arguments.ts(2707)
3 Replies
Andrii Sherman
Andrii Sherman15mo ago
I suggest to use this guide
Andrii Sherman
Andrii Sherman15mo ago
GitHub
drizzle-orm/custom-types.lite.md at main · drizzle-team/drizzle-orm
TypeScript ORM for SQL. Contribute to drizzle-team/drizzle-orm development by creating an account on GitHub.
Spoof
Spoof12mo ago
So to use citext would be as simple as:
import { customType } from "drizzle-orm/pg-core";

export const citext = customType<{ data: string }>({
dataType() {
return "citext";
},
});
import { customType } from "drizzle-orm/pg-core";

export const citext = customType<{ data: string }>({
dataType() {
return "citext";
},
});
Or would we need to more explicit with the driver types? Do they default to the data type?