Skip to content

Duplicate identifier in function declaration due to stripped property renames #50707

Description

@72636c

Bug Report

🔎 Search Terms

TS2300

🕗 Version & Regression Information

⏯ Playground Link

https://www.typescriptlang.org/play?#code/MYewdgzgLgBAZmGBeGAKA3jADgJxFgLhgEMAabPQmAIxgF8jNd8iwBXAW2oFMd6BKZAD4SMANQ0A3EA

💻 Code

const fn = ({ prop: a, prop: b }: { prop: number }) => a + b;

Or alternatively:

const fn = ({ prop: a }: { prop: number }, { prop: b }: { prop: number }) => a + b;

🙁 Actual behavior

.D.TS on TypeScript 4.8.2:

// error TS2300: Duplicate identifier 'prop'.
declare const fn: ({ prop, prop }: {
    prop: number;
}) => number;

https://www.typescriptlang.org/play?ts=4.8.2#code/MYewdgzgLgBAZmGBeGAKA3jADgJxFgLhgEMAabPQmAIxgF8jNd8iwBXAW2oFMd6BKZAD4SMANQ0A3EA

🙂 Expected behavior

.D.TS on TypeScript 4.7.4:

declare const fn: ({ prop: a, prop: b }: {
    prop: number;
}) => number;

https://www.typescriptlang.org/play?ts=4.7.4#code/MYewdgzgLgBAZmGBeGAKA3jADgJxFgLhgEMAabPQmAIxgF8jNd8iwBXAW2oFMd6BKZAD4SMANQ0A3EA

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptFix AvailableA PR has been opened for this issue

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions