Rename Symbol F2 with "pure keyof" is not possible - but it is possible if "wrapped as calculated property"
qwertysk opened this issue ยท comments
I think this could be related to typescript-language-server, even I reported it also here microsoft/TypeScript#56052
๐ Search Terms
Rename symbol, keyof
๐ Version & Regression Information
- This is the behavior in every version I tried
โฏ Playground Link
๐ป Code
////////////////////////// CASE 1 - keyof to computed property /////////////////////////
declare const Att_1: "Att 1"
interface Case_1 {
[Att_1]: string
}
declare const fnc_1: <K extends keyof Case_1>(p: K) => void
fnc_1("Att 1")
// ^_ Rename Symbol F2 => SUCCESS
////////////////////////// CASE 2 - pure keyof //////////////////////////
interface Case_2 {
"Att 2": string // here is the difference, pls compare to Case_1
}
declare const fnc_2: <K extends keyof Case_2>(p: K) => void
fnc_2("Att 2")
// ^_ Rename Symbol F2 => FAIL
๐ Actual behavior
It is wrong because Att 2
in interface Case_2
is not renamed
๐ Expected behavior
I expect Att 2
in interface Case_2
to be successfully renamed to Attribute 2
Additional information about the issue
Even it is not "a bug but the feature", is there best practice - if reliable renaming is really frequent and important in my project ?
PLS HELP ME โค๏ธโค๏ธโค๏ธ ... because manually create tons of constants for all project interfaces and all attributes - this is not maintanable way - any other ideas/patterns please ?
I think an issue in Typescript is enough since the logic for renaming is all there.