Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
jakebailey committed Sep 14, 2022
1 parent 4110b80 commit d75b631
Show file tree
Hide file tree
Showing 4 changed files with 100 additions and 0 deletions.
@@ -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;

@@ -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))

@@ -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

@@ -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;

0 comments on commit d75b631

Please sign in to comment.