Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Refacoring "Convert named export to default" removes function typeings #39410

Copy link
Copy link
@essenmitsosse

Description

@essenmitsosse
Issue body actions

TS Template added by @mjbvz

TypeScript Version: 4.0.0-dev.20200702

Search Terms

  • refactor / refactoring

  • VSCode Version: 1.46.1
  • OS Version: MacOS 10.15.5

Steps to Reproduce:

  1. Have a file with a named export, that is typed like this:
export const getFoo: (input: number) => number = (input) => input;
  1. Click "Convert named export to default" in the refactoring menu

  2. The refactored code new lacks the typing

export default (input) => input;

I would expect the refactoring to maintain the functions typing. For example like this:

const getFoo: (input: number) => number = (input) => input;
export default getFoo;

After all, the intend of the refactoring is to change the type of the export, not the way the code is written. I mainly use this refactoring, to automatically change the imports in other files. So for me, just removing the export before const and add a new line with export default getFoo would be sufficient for this refactoring.

Does this issue occur when all extensions are disabled?: Yes

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptA bug in TypeScriptDomain: LS: Refactoringse.g. extract to constant or function, rename symbole.g. extract to constant or function, rename symbol

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.