forked from microsoft/TypeScript
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4110b80
commit d75b631
Showing
4 changed files
with
100 additions
and
0 deletions.
There are no files selected for viewing
46 changes: 46 additions & 0 deletions
46
tests/baselines/reference/declarationEmitDuplicateParameterDestructuring.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
//// [declarationEmitDuplicateParameterDestructuring.ts] | ||
export const fn1 = ({ prop: a, prop: b }: { prop: number }) => a + b; | ||
|
||
export const fn2 = ({ prop: a }: { prop: number }, { prop: b }: { prop: number }) => a + b; | ||
|
||
|
||
|
||
|
||
//// [declarationEmitDuplicateParameterDestructuring.d.ts] | ||
export declare const fn1: ({ prop, prop }: { | ||
prop: number; | ||
}) => number; | ||
export declare const fn2: ({ prop }: { | ||
prop: number; | ||
}, { prop }: { | ||
prop: number; | ||
}) => number; | ||
|
||
|
||
//// [DtsFileErrors] | ||
|
||
|
||
tests/cases/compiler/declarationEmitDuplicateParameterDestructuring.d.ts(1,30): error TS2300: Duplicate identifier 'prop'. | ||
tests/cases/compiler/declarationEmitDuplicateParameterDestructuring.d.ts(1,36): error TS2300: Duplicate identifier 'prop'. | ||
tests/cases/compiler/declarationEmitDuplicateParameterDestructuring.d.ts(4,30): error TS2300: Duplicate identifier 'prop'. | ||
tests/cases/compiler/declarationEmitDuplicateParameterDestructuring.d.ts(6,6): error TS2300: Duplicate identifier 'prop'. | ||
|
||
|
||
==== tests/cases/compiler/declarationEmitDuplicateParameterDestructuring.d.ts (4 errors) ==== | ||
export declare const fn1: ({ prop, prop }: { | ||
~~~~ | ||
!!! error TS2300: Duplicate identifier 'prop'. | ||
~~~~ | ||
!!! error TS2300: Duplicate identifier 'prop'. | ||
prop: number; | ||
}) => number; | ||
export declare const fn2: ({ prop }: { | ||
~~~~ | ||
!!! error TS2300: Duplicate identifier 'prop'. | ||
prop: number; | ||
}, { prop }: { | ||
~~~~ | ||
!!! error TS2300: Duplicate identifier 'prop'. | ||
prop: number; | ||
}) => number; | ||
|
22 changes: 22 additions & 0 deletions
22
tests/baselines/reference/declarationEmitDuplicateParameterDestructuring.symbols
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
=== tests/cases/compiler/declarationEmitDuplicateParameterDestructuring.ts === | ||
export const fn1 = ({ prop: a, prop: b }: { prop: number }) => a + b; | ||
>fn1 : Symbol(fn1, Decl(declarationEmitDuplicateParameterDestructuring.ts, 0, 12)) | ||
>prop : Symbol(prop, Decl(declarationEmitDuplicateParameterDestructuring.ts, 0, 43)) | ||
>a : Symbol(a, Decl(declarationEmitDuplicateParameterDestructuring.ts, 0, 21)) | ||
>prop : Symbol(prop, Decl(declarationEmitDuplicateParameterDestructuring.ts, 0, 43)) | ||
>b : Symbol(b, Decl(declarationEmitDuplicateParameterDestructuring.ts, 0, 30)) | ||
>prop : Symbol(prop, Decl(declarationEmitDuplicateParameterDestructuring.ts, 0, 43)) | ||
>a : Symbol(a, Decl(declarationEmitDuplicateParameterDestructuring.ts, 0, 21)) | ||
>b : Symbol(b, Decl(declarationEmitDuplicateParameterDestructuring.ts, 0, 30)) | ||
|
||
export const fn2 = ({ prop: a }: { prop: number }, { prop: b }: { prop: number }) => a + b; | ||
>fn2 : Symbol(fn2, Decl(declarationEmitDuplicateParameterDestructuring.ts, 2, 12)) | ||
>prop : Symbol(prop, Decl(declarationEmitDuplicateParameterDestructuring.ts, 2, 34)) | ||
>a : Symbol(a, Decl(declarationEmitDuplicateParameterDestructuring.ts, 2, 21)) | ||
>prop : Symbol(prop, Decl(declarationEmitDuplicateParameterDestructuring.ts, 2, 34)) | ||
>prop : Symbol(prop, Decl(declarationEmitDuplicateParameterDestructuring.ts, 2, 65)) | ||
>b : Symbol(b, Decl(declarationEmitDuplicateParameterDestructuring.ts, 2, 52)) | ||
>prop : Symbol(prop, Decl(declarationEmitDuplicateParameterDestructuring.ts, 2, 65)) | ||
>a : Symbol(a, Decl(declarationEmitDuplicateParameterDestructuring.ts, 2, 21)) | ||
>b : Symbol(b, Decl(declarationEmitDuplicateParameterDestructuring.ts, 2, 52)) | ||
|
26 changes: 26 additions & 0 deletions
26
tests/baselines/reference/declarationEmitDuplicateParameterDestructuring.types
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
=== tests/cases/compiler/declarationEmitDuplicateParameterDestructuring.ts === | ||
export const fn1 = ({ prop: a, prop: b }: { prop: number }) => a + b; | ||
>fn1 : ({ prop, prop }: { prop: number;}) => number | ||
>({ prop: a, prop: b }: { prop: number }) => a + b : ({ prop, prop }: { prop: number;}) => number | ||
>prop : any | ||
>a : number | ||
>prop : any | ||
>b : number | ||
>prop : number | ||
>a + b : number | ||
>a : number | ||
>b : number | ||
|
||
export const fn2 = ({ prop: a }: { prop: number }, { prop: b }: { prop: number }) => a + b; | ||
>fn2 : ({ prop }: { prop: number;}, { prop }: { prop: number;}) => number | ||
>({ prop: a }: { prop: number }, { prop: b }: { prop: number }) => a + b : ({ prop }: { prop: number;}, { prop }: { prop: number;}) => number | ||
>prop : any | ||
>a : number | ||
>prop : number | ||
>prop : any | ||
>b : number | ||
>prop : number | ||
>a + b : number | ||
>a : number | ||
>b : number | ||
|
6 changes: 6 additions & 0 deletions
6
tests/cases/compiler/declarationEmitDuplicateParameterDestructuring.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// @declaration: true | ||
// @emitDeclarationOnly: true | ||
|
||
export const fn1 = ({ prop: a, prop: b }: { prop: number }) => a + b; | ||
|
||
export const fn2 = ({ prop: a }: { prop: number }, { prop: b }: { prop: number }) => a + b; |