-
Notifications
You must be signed in to change notification settings - Fork 12.2k
/
extendArray.errors.txt
34 lines (27 loc) · 1.16 KB
/
extendArray.errors.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
tests/cases/compiler/extendArray.ts(7,19): error TS2552: Cannot find name '_element'. Did you mean 'Element'?
tests/cases/compiler/extendArray.ts(7,32): error TS2552: Cannot find name '_element'. Did you mean 'Element'?
==== tests/cases/compiler/extendArray.ts (2 errors) ====
var a = [1,2];
a.forEach(function (v,i,a) {});
declare module _Core {
interface Array {
collect(fn:(e:_element) => _element[]) : any[];
~~~~~~~~
!!! error TS2552: Cannot find name '_element'. Did you mean 'Element'?
!!! related TS2728 /.ts/lib.dom.d.ts:4792:13: 'Element' is declared here.
~~~~~~~~
!!! error TS2552: Cannot find name '_element'. Did you mean 'Element'?
!!! related TS2728 /.ts/lib.dom.d.ts:4792:13: 'Element' is declared here.
}
}
var arr = (<any>Array).prototype;
arr.collect = function (fn) {
var res = [];
for (var i = 0; i < this.length; ++i) {
var tmp = fn(this[i]);
for (var j = 0; j < tmp.length; ++j) {
res.push(tmp[j]);
}
}
return res;
};