Typing `varchar` with a type reference instead of `enum` value

using varchar and enum in the docs:
import { varchar, pgTable } from "drizzle-orm/pg-core";
export const table = pgTable('table', {
  varchar1: varchar('varchar1'),
  varchar2: varchar('varchar2', { length: 256 }),
});
// will be inferred as text: "value1" | "value2" | null
varchar: varchar('varchar', { enum: ["value1", "value2"] }),

CREATE TABLE IF NOT EXISTS "table" (
  "varchar1" varchar,
  "varchar2" varchar(256),
);

makes using an external value as enum a bit complex. and requires me to import an actual runtime value, even though it's not being used.
import { pokemonNames } from '@myorg/pokemon-lib' 

// typeof pokemonNames - ('bulbasaur' | 'venosaur' | ... |'mew')[]
...
    pokemon: varchar('pokempon', {enum: pokemonNames}),
...

this value would not be used in runtime, but only in dev / build type when types matter.

I think it's better to type these fields with a type statement:
import type { PokemonName } from '@myorg/pokemon-lib' 

...
    pokemon: varchar<PokemonName[]>('pokempon'),
...


is there an elegant way to do it?
I could as a workaround use
    
    pokemon: varchar('pokempon', enum: ... as PokemonName[] ),

but this feels very hacky, any thoughts? suggestions?
Was this page helpful?