Skip to content

Use type-only imports #61

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
not-matt opened this issue May 23, 2025 · 0 comments
Open

Use type-only imports #61

not-matt opened this issue May 23, 2025 · 0 comments

Comments

@not-matt
Copy link

❌ TS error on generated code when verbatimModuleSyntax is enabled

// Code generated by sqlc. DO NOT EDIT.

import mysql, { RowDataPacket, ResultSetHeader } from "mysql2/promise";
                ^^^^^^^^^^^^^  ^^^^^^^^^^^^^^^
                `'ResultSetHeader' is a type and must be imported using a 
                type-only import when 'verbatimModuleSyntax' is enabled.ts(1484)`

✅ Fixed by adding type keyword

import mysql, { type RowDataPacket, type ResultSetHeader } from "mysql2/promise";

Hopefully it is a simple addition to add the type keyword to these imports by default.
The imports are both interfaces so would only be used as types.
This change is also compatible if verbatimModuleSyntax is not enabled.

@not-matt not-matt changed the title Add type-only imports Use type-only imports May 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant