Skip to content

Renaming an object property on destructuring (aliasing) also changes type definition. #44627

Closed
@dalmo3

Description

@dalmo3

Bug Report

I ran into this strange bug where renaming a property on destructuring will also rename the original property in the type definition.

This is a gif that shows what happens: I'm using VSCode's rename function on F2.

destruct-rename

The expected behaviour is that it should just create an alias for the property and update its usage down the file, without also changing the type. In fact, that's what usually happens.

This bug is somewhat random and I can't easily reproduce it. It was just the 4th or 5th time it happened when I decided to write it here. Apparently it doesn't go away by restarting the ts server, but it does by reloading VSCode.

🕗 Version & Regression Information

TS 4.3.2
VSCode insiders 1.57
WSL2

💻 Code

typescript.preferences.useAliasesForRenames: true

{
  "compilerOptions": {
    "target": "es5",
    "lib": ["dom", "dom.iterable", "esnext"],
    "allowJs": true,
    "skipLibCheck": true,
    "esModuleInterop": true,
    "allowSyntheticDefaultImports": true,
    "strict": true,
    "forceConsistentCasingInFileNames": true,
    "noFallthroughCasesInSwitch": true,
    "module": "esnext",
    "moduleResolution": "node",
    "resolveJsonModule": true,
    "isolatedModules": true,
    "noEmit": true,
    "jsx": "react-jsx",
    "baseUrl": "."
    // "noImplicitAny": false
  },
  "include": ["src"]
}

I understand that there is very little actionable information here. Let me know how can I collect more info about it next time it happens.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs More InfoThe issue still hasn't been fully clarified

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions