-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Closed
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 symbolFixedA PR has been merged for this issueA PR has been merged for this issue
Milestone
Description
TypeScript Version: [email protected]
Search Terms:
- refactor
- extract
Code
let value: string;
switch (Date.now()) {
case 1:
value = 'one';
break;
default:
value = 'other';
break;
}
console.log(value);Select everything from let value to the end of the switch statement
Expected behavior:
A refactoring for extract to function is offered. It should change the code to something like:
let value = newFunction();
console.log(value);
function newFunction() {
let value: string;
switch (Date.now()) {
case 1:
value = 'one';
break;
default:
value = 'other';
break;
}
return value;
}Actual behavior:
No refactoring offered
Playground Link:
Related Issues:
Metadata
Metadata
Assignees
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 symbolFixedA PR has been merged for this issueA PR has been merged for this issue