Skip to content

Commit f85ca9c

Browse files
committed
Test that rest of untyped binding pattern is any
1 parent fe55edc commit f85ca9c

File tree

4 files changed

+22
-0
lines changed

4 files changed

+22
-0
lines changed

tests/baselines/reference/objectRest.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ let computed = 'b';
3636
let computed2 = 'a';
3737
var { [computed]: stillNotGreat, [computed2]: soSo, ...o } = o;
3838
({ [computed]: stillNotGreat, [computed2]: soSo, ...o } = o);
39+
40+
var noContextualType = ({ aNumber = 12, ...notEmptyObject }) => aNumber;
3941

4042

4143
//// [objectRest.js]
@@ -76,4 +78,8 @@ let computed = 'b';
7678
let computed2 = 'a';
7779
var _g = computed, stillNotGreat = o[_g], _h = computed2, soSo = o[_h], o = __rest(o, [typeof _g === "symbol" ? _g : _g + "", typeof _h === "symbol" ? _h : _h + ""]);
7880
(_j = computed, stillNotGreat = o[_j], _k = computed2, soSo = o[_k], o = __rest(o, [typeof _j === "symbol" ? _j : _j + "", typeof _k === "symbol" ? _k : _k + ""]));
81+
var noContextualType = (_a) => {
82+
var { aNumber = 12 } = _a, notEmptyObject = __rest(_a, ["aNumber"]);
83+
return aNumber;
84+
};
7985
var _d, _f, _j, _k;

tests/baselines/reference/objectRest.symbols

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,3 +169,9 @@ var { [computed]: stillNotGreat, [computed2]: soSo, ...o } = o;
169169
>o : Symbol(o, Decl(objectRest.ts, 0, 3), Decl(objectRest.ts, 35, 51))
170170
>o : Symbol(o, Decl(objectRest.ts, 0, 3), Decl(objectRest.ts, 35, 51))
171171

172+
var noContextualType = ({ aNumber = 12, ...notEmptyObject }) => aNumber;
173+
>noContextualType : Symbol(noContextualType, Decl(objectRest.ts, 38, 3))
174+
>aNumber : Symbol(aNumber, Decl(objectRest.ts, 38, 25))
175+
>notEmptyObject : Symbol(notEmptyObject, Decl(objectRest.ts, 38, 39))
176+
>aNumber : Symbol(aNumber, Decl(objectRest.ts, 38, 25))
177+

tests/baselines/reference/objectRest.types

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,3 +195,11 @@ var { [computed]: stillNotGreat, [computed2]: soSo, ...o } = o;
195195
>o : { a: number; b: string; }
196196
>o : { a: number; b: string; }
197197

198+
var noContextualType = ({ aNumber = 12, ...notEmptyObject }) => aNumber;
199+
>noContextualType : ({aNumber, ...notEmptyObject}: { aNumber?: number; }) => number
200+
>({ aNumber = 12, ...notEmptyObject }) => aNumber : ({aNumber, ...notEmptyObject}: { aNumber?: number; }) => number
201+
>aNumber : number
202+
>12 : 12
203+
>notEmptyObject : any
204+
>aNumber : number
205+

tests/cases/conformance/types/rest/objectRest.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,5 @@ let computed = 'b';
3636
let computed2 = 'a';
3737
var { [computed]: stillNotGreat, [computed2]: soSo, ...o } = o;
3838
({ [computed]: stillNotGreat, [computed2]: soSo, ...o } = o);
39+
40+
var noContextualType = ({ aNumber = 12, ...notEmptyObject }) => aNumber;

0 commit comments

Comments
 (0)