Skip to content

"... is a type and must be imported using a type-only import ..." should have a quick fixΒ #52444

@jakebailey

Description

@jakebailey

Suggestion

πŸ” Search Terms

verbatimModuleSyntax type quick fix

βœ… Viability Checklist

My suggestion meets these guidelines:

  • This wouldn't be a breaking change in existing TypeScript/JavaScript code
  • This wouldn't change the runtime behavior of existing JavaScript code
  • This could be implemented without emitting different JS based on the types of the expressions
  • This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, new syntax sugar for JS, etc.)
  • This feature would agree with the rest of TypeScript's Design Goals.

⭐ Suggestion

I am trying out the beta, and got this message when enabling verbatimModuleSyntax (as expected). However, the only quick fix available to me was the one to convert the import to a namespace import.

πŸ“ƒ Motivating Example

import { ImAType, NotAType } from "foo";

Becomes:

import { type ImAType, NotAType } from "foo";

Or:

import { type ImAType } from "foo";
import { NotAType } from "foo";

I thought we had it (maybe it only works for preserveValueImports?)

πŸ’» Use Cases

People switching these new stricter flags on.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions