fix: use type-only import in TypeScript migration template#1579
Merged
Shinigami92 merged 1 commit intosalsita:mainfrom Mar 17, 2026
Merged
fix: use type-only import in TypeScript migration template#1579Shinigami92 merged 1 commit intosalsita:mainfrom
Shinigami92 merged 1 commit intosalsita:mainfrom
Conversation
The default TypeScript template imports `ColumnDefinitions` as a value, but it is only exported as a TypeScript type (no runtime representation). This works with traditional `tsc` compilation (which erases unused value imports), but fails when loading `.ts` files directly via tsx, swc, or Node.js 22.6+ `--experimental-strip-types` because the ESM loader checks module exports before types are stripped: SyntaxError: The requested module 'node-pg-migrate' does not provide an export named 'ColumnDefinitions' The fix aligns the template with the rest of the codebase, which already uses `import type` for `ColumnDefinitions` everywhere (src/migration.ts, src/runner.ts, test files, etc.). Fixes salsita#1578
Shinigami92
approved these changes
Mar 17, 2026
Collaborator
|
I'm on the wrong PC to init the release, I need to switch release pipeline to new npm oidc token process and the old npm token is expired. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The default TypeScript migration template (
templates/migration-template.ts) importsColumnDefinitionsas a value import, but it is only exported as a TypeScript type — no runtime representation exists in the compiled JavaScript bundle.This causes a
SyntaxErrorwhen loading.tsmigration files directly via tsx, swc, or Node.js 22.6+ with--experimental-strip-types:Why it breaks
tsc→.js→ NodeThe fix
This aligns the template with the rest of the codebase, which already uses
import typeforColumnDefinitionseverywhere:src/migration.ts→import type { ColumnDefinitions }src/runner.ts→import type { ColumnDefinitions }src/migrationBuilder.ts→import type { ColumnDefinitions }test/ts/migrations/*.ts→import type { ColumnDefinitions, MigrationBuilder }test/jiti/migrations/*.ts→import type { ColumnDefinitions, MigrationBuilder }Fixes #1578