mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-14 19:16:17 -06:00
Add test case for destructured unused parameter
This commit is contained in:
parent
a8db81393f
commit
1e32b6742e
15
tests/baselines/reference/unusedDestructuringParameters.js
Normal file
15
tests/baselines/reference/unusedDestructuringParameters.js
Normal file
@ -0,0 +1,15 @@
|
||||
//// [unusedDestructuringParameters.ts]
|
||||
const f = ([a]) => { };
|
||||
f([1]);
|
||||
const f2 = ({a}) => { };
|
||||
f2({ a: 10 });
|
||||
|
||||
//// [unusedDestructuringParameters.js]
|
||||
var f = function (_a) {
|
||||
var a = _a[0];
|
||||
};
|
||||
f([1]);
|
||||
var f2 = function (_a) {
|
||||
var a = _a.a;
|
||||
};
|
||||
f2({ a: 10 });
|
||||
@ -0,0 +1,16 @@
|
||||
=== tests/cases/compiler/unusedDestructuringParameters.ts ===
|
||||
const f = ([a]) => { };
|
||||
>f : Symbol(f, Decl(unusedDestructuringParameters.ts, 0, 5))
|
||||
>a : Symbol(a, Decl(unusedDestructuringParameters.ts, 0, 12))
|
||||
|
||||
f([1]);
|
||||
>f : Symbol(f, Decl(unusedDestructuringParameters.ts, 0, 5))
|
||||
|
||||
const f2 = ({a}) => { };
|
||||
>f2 : Symbol(f2, Decl(unusedDestructuringParameters.ts, 2, 5))
|
||||
>a : Symbol(a, Decl(unusedDestructuringParameters.ts, 2, 13))
|
||||
|
||||
f2({ a: 10 });
|
||||
>f2 : Symbol(f2, Decl(unusedDestructuringParameters.ts, 2, 5))
|
||||
>a : Symbol(a, Decl(unusedDestructuringParameters.ts, 3, 4))
|
||||
|
||||
@ -0,0 +1,24 @@
|
||||
=== tests/cases/compiler/unusedDestructuringParameters.ts ===
|
||||
const f = ([a]) => { };
|
||||
>f : ([a]: [any]) => void
|
||||
>([a]) => { } : ([a]: [any]) => void
|
||||
>a : any
|
||||
|
||||
f([1]);
|
||||
>f([1]) : void
|
||||
>f : ([a]: [any]) => void
|
||||
>[1] : [number]
|
||||
>1 : 1
|
||||
|
||||
const f2 = ({a}) => { };
|
||||
>f2 : ({a}: { a: any; }) => void
|
||||
>({a}) => { } : ({a}: { a: any; }) => void
|
||||
>a : any
|
||||
|
||||
f2({ a: 10 });
|
||||
>f2({ a: 10 }) : void
|
||||
>f2 : ({a}: { a: any; }) => void
|
||||
>{ a: 10 } : { a: number; }
|
||||
>a : number
|
||||
>10 : 10
|
||||
|
||||
5
tests/cases/compiler/unusedDestructuringParameters.ts
Normal file
5
tests/cases/compiler/unusedDestructuringParameters.ts
Normal file
@ -0,0 +1,5 @@
|
||||
//@noUnusedParameters: true
|
||||
const f = ([a]) => { };
|
||||
f([1]);
|
||||
const f2 = ({a}) => { };
|
||||
f2({ a: 10 });
|
||||
Loading…
x
Reference in New Issue
Block a user