-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Open
Labels
Experience EnhancementNoncontroversial enhancementsNoncontroversial enhancementsSuggestionAn idea for TypeScriptAn idea for TypeScript
Milestone
Description
TypeScript Version: 3.5.0-dev.20190412
Search Terms: hyphen refactor, dash rename
Code
interface TestObject {
test:string
}
const instance: TestObject = { test: "hello" };
console.log(instance.test);Rename "test" to a variable with a hyphen, e.g "te-st"
Expected behavior:
Code is refactored to use quotes:
interface TestObject {
"te-st":string
}
const instance: TestObject = { "te-st": "hello" };
console.log(instance["te-st"]);Actual behavior:
Refactor replaces the variable as given, producing invalid code
interface TestObject {
te-st:string
}
const instance: TestObject = { te-st: "hello" };
console.log(instance.te-st);Playground Link: Replacing all occurrences in the playground also includes all Test matches, so I tested this in vscode
Related Issues: none I could find
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Experience EnhancementNoncontroversial enhancementsNoncontroversial enhancementsSuggestionAn idea for TypeScriptAn idea for TypeScript