Skip to content
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

Invalid verbatimModuleSyntax quick fix offered when also reexporting a value #57761

Closed
acutmore opened this issue Mar 13, 2024 · 0 comments Β· Fixed by #57769
Closed

Invalid verbatimModuleSyntax quick fix offered when also reexporting a value #57761

acutmore opened this issue Mar 13, 2024 · 0 comments Β· Fixed by #57769
Labels
Bug A bug in TypeScript Domain: Refactorings e.g. extract to constant or function, rename symbol Help Wanted You can do this
Milestone

Comments

@acutmore
Copy link
Contributor

πŸ”Ž Search Terms

quick fix, verbatimModuleSyntax, value re-export

πŸ•— Version & Regression Information

⏯ Playground Link

https://www.typescriptlang.org/play?verbatimModuleSyntax=true&ts=5.4.2#code/JYWwDg9gTgLgBAbzgQQEYGcZQIYGMYBqwApgO4A0cIxIEcAvnAGZQQhwBEUxeMHA3ACgA9MLgA9cXBik6ARwCuwXAGtmwAB7o4wAHa4ANgoAmegOZwA5KEixpATzDE4AOjeW4gGXJBg4htvwSDCOzmiYOPhEZJTUtAw+onC4bGDY3MbSdKjEBhCkAFw+NtCBcAAq2How2KgGxACqusCKxATYRsSUCujEALI0dAzMrOxcPPgCImKScBC6BvbqGjraegZ6zpbBTh6AoOQ+fgFJc5hw3X0DAExwALxnPf20Qr7+JQ5OiOWVutW1DU0tNodeJAA

πŸ’» Code

// verbatimModuleSyntax: true

import { AbstractView, memo } from "react";
// ^^ two quick fixs including 'import type ...' ❌

export { type AbstractView, memo }

// compared to below:

import { TaintableUniqueValue, useMemo  } from "react";
// ^^ only fix is inline 'type' βœ…

export const useMemo2 = useMemo;

export type { TaintableUniqueValue }

πŸ™ Actual behavior

Quick fix is offering to convert the whole import to a import type.

πŸ™‚ Expected behavior

Only offer a quick fix of marking the individual named import with type <name>

Additional information about the issue

This only appears to happen when the values being imported are only re-exported.

While a user is free to pick the more appropriate quick fix, it adds complexity when running the quickfixes on mass on large code bases where making individual judgment calls for each fix could take too long.

@RyanCavanaugh RyanCavanaugh added Bug A bug in TypeScript Help Wanted You can do this Domain: Refactorings e.g. extract to constant or function, rename symbol labels Mar 13, 2024
@RyanCavanaugh RyanCavanaugh added this to the Backlog milestone Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Domain: Refactorings e.g. extract to constant or function, rename symbol Help Wanted You can do this
Projects
None yet
2 participants