microsoft / TypeScript-Sublime-Plugin

IO wrapper around TypeScript language services, allowing for easy consumption by editor plugins
Apache License 2.0
1.72k stars 235 forks source link

Rename Symbol is messing up object literal shorthand #673

Closed lordnox closed 6 years ago

lordnox commented 6 years ago

Example Code:

interface ITest {
  x: number
}
const createTest = (): ITest => {
  const x = Math.random()
  return {
    x,
  }
}

When trying to rename const x to const rnd the code will become:

interface ITest {
  x: number
}
const createTest = (): ITest => {
  const rnd = Math.random()
  return {
    rnd,
  }
}

This does kind of do the right thing, but changes the return type of the function and should actually become:

interface ITest {
  x: number
}
const createTest = (): ITest => {
  const rnd = Math.random()
  return {
    x: rnd,
  }
}
DanielRosenwasser commented 6 years ago

This issue was moved to Microsoft/TypeScript#27189