Skip to content

variable renaming should take into account ES6 property value shorthand #16435

Description

@nippur72

Renaming from the IDE is not safe if the renamed variable is used to initialize an object with the ES6 property value shorthand syntax.

Example:

interface IFoo {
   foo: string
}
const foo = "hello";   // <- rename foo into foo1
const bar: IFoo = { foo };

if on the IDE I rename foo into foo1 (at line 4), then the code will break because bar now has a property named foo1 which does not exist in its interface:

const bar: IFoo = { foo1 };

Ideally the IDE should be smart enough and modify the code in:

const bar: IFoo = { foo: foo1 };

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions