You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
codegen-ts 0.24.0 emits enum types as value imports — TS1484 under verbatimModuleSyntax (regression from 0.23.1) #341
DispositionEnum is a type; only DispositionEnumEnum is a runtime value. Under verbatimModuleSyntax: true — the default in the current Vite + TS project templates — that is
a hard error, so tsc fails on generated code the adopter cannot edit.
Observed
src/generated/DispositionChangeView.ts(5,10): error TS1484: 'DispositionEnum' is a type and must
be imported using a type-only import when 'verbatimModuleSyntax' is enabled.
12 such errors across 9 generated files in one project. Every one is in src/generated/.
The two symbols come from the generator's own enums.ts, which is unambiguous about which is
which:
Affected symbols in this project: DispositionEnum, EquipmentSlotEnum, ActionTypeEnum, DifficultyEnum, MemoryCategoryEnum — i.e. any field.enum referenced from a generated view.
Why it did not show up everywhere
Two sibling apps in the same repository consume the same generator. Only one fails, and the
difference is exactly one setting:
app
verbatimModuleSyntax
tsc
app A
unset
passes
app B
true (in tsconfig.app.json and tsconfig.node.json)
12 errors
So the bug is invisible to any project that has not enabled it, which is presumably why it
shipped. It is a regression against 0.23.1, where the same project's tsc -b exited 0.
Or emit import { type DispositionEnum, DispositionEnumEnum } from "./enums";, which is
equivalent and keeps it to one statement. Either form is also correct when verbatimModuleSyntax is off, so there is no need to detect the setting.
Worth a generator test compiled with verbatimModuleSyntax: true, since that is the only
configuration in which this class of defect is visible at all — a type/value split emitted
wrongly is silently fine everywhere else.
Workaround for adopters today
None that is not a downgrade. The files are generated, so they cannot be hand-fixed durably; the
only lever is turning verbatimModuleSyntax off, which weakens the project's own type-safety
settings to accommodate generated code. Projects with it enabled are effectively blocked on 0.24.0 for the TypeScript surface.
The type is now emitted with ts-poet's t: marker, so a shared enum splits correctly: import { type DispositionEnum, DispositionEnumEnum } from "./enums" — the form your
"suggested fix" named, and valid with the flag off too.
Worth recording where the gate was: verbatim-module-syntax-compile.test.ts already
existed and already compiled real output under verbatimModuleSyntax: true. It missed this
because its fixture had no enum — and adding one was not enough. An entity types its
enum column through Drizzle's InferSelectModel and only ever imports the Zod const,
which is correctly a value, so an entity fixture compiles clean with the bug fully present.
The defect lives on the value-object path, which declares an explicit interface member
and imports the type by name. The gate now uses that shape and was verified by reverting
the fix: it fails on both dialects with the exact TS1484 text.
Activity
fix(codegen-ts): emit a shared enum's TYPE as a type-only import (#341)
docs(changelog): 0.24.1 records the adopter batch — #339, #340, #341, #…
dmealing commentedon Aug 23, 2026
Fixed on
mainin c1bf5a4, shipping in0.24.1.The type is now emitted with ts-poet's
t:marker, so a shared enum splits correctly:import { type DispositionEnum, DispositionEnumEnum } from "./enums"— the form your"suggested fix" named, and valid with the flag off too.
Worth recording where the gate was:
verbatim-module-syntax-compile.test.tsalreadyexisted and already compiled real output under
verbatimModuleSyntax: true. It missed thisbecause its fixture had no enum — and adding one was not enough. An entity types its
enum column through Drizzle's
InferSelectModeland only ever imports the Zod const,which is correctly a value, so an entity fixture compiles clean with the bug fully present.
The defect lives on the value-object path, which declares an explicit interface member
and imports the type by name. The gate now uses that shape and was verified by reverting
the fix: it fails on both dialects with the exact TS1484 text.