Closed
Description
Bug Report
🔎 Search Terms
TS2300
🕗 Version & Regression Information
- This changed between versions 4.7.4 and 4.8.2
- Similar to Isssue generating declaration files with object containing keywords as property #50483 and likely introduced by Forbid unused property renaming in destructuring binding in function types #41044
- Persists in 4.8.3, nightly, and 🤖 Pick PR #50537 (Retain name and propertyName in dec...) into release-4.8 #50538 (https://github.com/72636c/typescript-4.8-declaration-poc)
⏯ Playground Link
💻 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;
🙂 Expected behavior
.D.TS on TypeScript 4.7.4:
declare const fn: ({ prop: a, prop: b }: {
prop: number;
}) => number;