Skip to content

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

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

Closed
5 tasks done
jakebailey opened this issue Jan 27, 2023 Β· 2 comments Β· Fixed by #52565
Closed
5 tasks done
Labels
Experience Enhancement Noncontroversial enhancements Help Wanted You can do this Suggestion An idea for TypeScript

Comments

@jakebailey
Copy link
Member

jakebailey commented Jan 27, 2023 β€’

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.

@sultondev
Copy link

Thanks bro

@Hi99s
Copy link

Hi99s commented Aug 1, 2023

Thanks

@microsoft microsoft locked and limited conversation to collaborators Aug 1, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Experience Enhancement Noncontroversial enhancements Help Wanted You can do this Suggestion An idea for TypeScript
Projects
None yet
5 participants