Skip to content

Use type-only imports #61

Description

@not-matt

❌ 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions