microsoft / microsoft/TypeScript
Rename field to a name with dash does not transform the field with quotes.
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.3k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 132
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the rename in VS Code using the TypeScript example, changing test to te-st. Trace the rename refactor behavior for the interface property, object literal, and member access; done means all affected references use valid quoted properties and bracket access as shown in the expected output, with regression coverage added in the relevant test suite.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100