Skip to content

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

@acutmore

Description

@acutmore

πŸ”Ž 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptDomain: LS: Refactoringse.g. extract to constant or function, rename symbolHelp WantedYou can do this

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions