Skip to content

Commit 82f75bb

Browse files
committed
Refactored typed arrays.
previous: ``` PS C:\Users\aval\tsdev\TypeScript> node built\local\tsc.js --diagnostics --p src\compiler\tsconfig.json Files: 36 Lines: 93186 Nodes: 445312 Identifiers: 168285 Symbols: 71668 Types: 32088 Memory used: 371617K I/O read: 0.02s I/O write: 0.17s Parse time: 0.71s Bind time: 0.62s Check time: 2.90s Emit time: 2.06s Total time: 6.29s ``` now: ``` PS C:\Users\aval\tsdev\TypeScript> node built\local\tsc.js --diagnostics --p src\compiler\tsconfig.json Files: 36 Lines: 91099 Nodes: 439748 Identifiers: 166769 Symbols: 71022 Types: 31979 Memory used: 369763K I/O read: 0.02s I/O write: 0.03s Parse time: 0.69s Bind time: 0.59s Check time: 2.92s Emit time: 1.89s Total time: 6.09s ``` Fixes #15402
1 parent ca181a7 commit 82f75bb

File tree

5 files changed

+269
-2657
lines changed

5 files changed

+269
-2657
lines changed

src/lib/es2015.iterable.d.ts

+4-233
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ interface String {
215215
[Symbol.iterator](): IterableIterator<string>;
216216
}
217217

218-
interface Int8Array {
218+
interface TypedArray<T> {
219219
[Symbol.iterator](): IterableIterator<number>;
220220
/**
221221
* Returns an array of key, value pairs for every entry in the array
@@ -231,243 +231,14 @@ interface Int8Array {
231231
values(): IterableIterator<number>;
232232
}
233233

234-
interface Int8ArrayConstructor {
235-
new (elements: Iterable<number>): Int8Array;
234+
interface TypedArrayConstructor<T> {
235+
new (elements: Iterable<number>): T;
236236

237237
/**
238238
* Creates an array from an array-like or iterable object.
239239
* @param arrayLike An array-like or iterable object to convert to an array.
240240
* @param mapfn A mapping function to call on every element of the array.
241241
* @param thisArg Value of 'this' used to invoke the mapfn.
242242
*/
243-
from(arrayLike: Iterable<number>, mapfn?: (v: number, k: number) => number, thisArg?: any): Int8Array;
244-
}
245-
246-
interface Uint8Array {
247-
[Symbol.iterator](): IterableIterator<number>;
248-
/**
249-
* Returns an array of key, value pairs for every entry in the array
250-
*/
251-
entries(): IterableIterator<[number, number]>;
252-
/**
253-
* Returns an list of keys in the array
254-
*/
255-
keys(): IterableIterator<number>;
256-
/**
257-
* Returns an list of values in the array
258-
*/
259-
values(): IterableIterator<number>;
260-
}
261-
262-
interface Uint8ArrayConstructor {
263-
new (elements: Iterable<number>): Uint8Array;
264-
265-
/**
266-
* Creates an array from an array-like or iterable object.
267-
* @param arrayLike An array-like or iterable object to convert to an array.
268-
* @param mapfn A mapping function to call on every element of the array.
269-
* @param thisArg Value of 'this' used to invoke the mapfn.
270-
*/
271-
from(arrayLike: Iterable<number>, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8Array;
272-
}
273-
274-
interface Uint8ClampedArray {
275-
[Symbol.iterator](): IterableIterator<number>;
276-
/**
277-
* Returns an array of key, value pairs for every entry in the array
278-
*/
279-
entries(): IterableIterator<[number, number]>;
280-
281-
/**
282-
* Returns an list of keys in the array
283-
*/
284-
keys(): IterableIterator<number>;
285-
286-
/**
287-
* Returns an list of values in the array
288-
*/
289-
values(): IterableIterator<number>;
290-
}
291-
292-
interface Uint8ClampedArrayConstructor {
293-
new (elements: Iterable<number>): Uint8ClampedArray;
294-
295-
296-
/**
297-
* Creates an array from an array-like or iterable object.
298-
* @param arrayLike An array-like or iterable object to convert to an array.
299-
* @param mapfn A mapping function to call on every element of the array.
300-
* @param thisArg Value of 'this' used to invoke the mapfn.
301-
*/
302-
from(arrayLike: Iterable<number>, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8ClampedArray;
303-
}
304-
305-
interface Int16Array {
306-
[Symbol.iterator](): IterableIterator<number>;
307-
/**
308-
* Returns an array of key, value pairs for every entry in the array
309-
*/
310-
entries(): IterableIterator<[number, number]>;
311-
312-
/**
313-
* Returns an list of keys in the array
314-
*/
315-
keys(): IterableIterator<number>;
316-
317-
/**
318-
* Returns an list of values in the array
319-
*/
320-
values(): IterableIterator<number>;
321-
}
322-
323-
interface Int16ArrayConstructor {
324-
new (elements: Iterable<number>): Int16Array;
325-
326-
/**
327-
* Creates an array from an array-like or iterable object.
328-
* @param arrayLike An array-like or iterable object to convert to an array.
329-
* @param mapfn A mapping function to call on every element of the array.
330-
* @param thisArg Value of 'this' used to invoke the mapfn.
331-
*/
332-
from(arrayLike: Iterable<number>, mapfn?: (v: number, k: number) => number, thisArg?: any): Int16Array;
333-
}
334-
335-
interface Uint16Array {
336-
[Symbol.iterator](): IterableIterator<number>;
337-
/**
338-
* Returns an array of key, value pairs for every entry in the array
339-
*/
340-
entries(): IterableIterator<[number, number]>;
341-
/**
342-
* Returns an list of keys in the array
343-
*/
344-
keys(): IterableIterator<number>;
345-
/**
346-
* Returns an list of values in the array
347-
*/
348-
values(): IterableIterator<number>;
349-
}
350-
351-
interface Uint16ArrayConstructor {
352-
new (elements: Iterable<number>): Uint16Array;
353-
354-
/**
355-
* Creates an array from an array-like or iterable object.
356-
* @param arrayLike An array-like or iterable object to convert to an array.
357-
* @param mapfn A mapping function to call on every element of the array.
358-
* @param thisArg Value of 'this' used to invoke the mapfn.
359-
*/
360-
from(arrayLike: Iterable<number>, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint16Array;
361-
}
362-
363-
interface Int32Array {
364-
[Symbol.iterator](): IterableIterator<number>;
365-
/**
366-
* Returns an array of key, value pairs for every entry in the array
367-
*/
368-
entries(): IterableIterator<[number, number]>;
369-
/**
370-
* Returns an list of keys in the array
371-
*/
372-
keys(): IterableIterator<number>;
373-
/**
374-
* Returns an list of values in the array
375-
*/
376-
values(): IterableIterator<number>;
377-
}
378-
379-
interface Int32ArrayConstructor {
380-
new (elements: Iterable<number>): Int32Array;
381-
382-
/**
383-
* Creates an array from an array-like or iterable object.
384-
* @param arrayLike An array-like or iterable object to convert to an array.
385-
* @param mapfn A mapping function to call on every element of the array.
386-
* @param thisArg Value of 'this' used to invoke the mapfn.
387-
*/
388-
from(arrayLike: Iterable<number>, mapfn?: (v: number, k: number) => number, thisArg?: any): Int32Array;
389-
}
390-
391-
interface Uint32Array {
392-
[Symbol.iterator](): IterableIterator<number>;
393-
/**
394-
* Returns an array of key, value pairs for every entry in the array
395-
*/
396-
entries(): IterableIterator<[number, number]>;
397-
/**
398-
* Returns an list of keys in the array
399-
*/
400-
keys(): IterableIterator<number>;
401-
/**
402-
* Returns an list of values in the array
403-
*/
404-
values(): IterableIterator<number>;
405-
}
406-
407-
interface Uint32ArrayConstructor {
408-
new (elements: Iterable<number>): Uint32Array;
409-
410-
/**
411-
* Creates an array from an array-like or iterable object.
412-
* @param arrayLike An array-like or iterable object to convert to an array.
413-
* @param mapfn A mapping function to call on every element of the array.
414-
* @param thisArg Value of 'this' used to invoke the mapfn.
415-
*/
416-
from(arrayLike: Iterable<number>, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint32Array;
417-
}
418-
419-
interface Float32Array {
420-
[Symbol.iterator](): IterableIterator<number>;
421-
/**
422-
* Returns an array of key, value pairs for every entry in the array
423-
*/
424-
entries(): IterableIterator<[number, number]>;
425-
/**
426-
* Returns an list of keys in the array
427-
*/
428-
keys(): IterableIterator<number>;
429-
/**
430-
* Returns an list of values in the array
431-
*/
432-
values(): IterableIterator<number>;
433-
}
434-
435-
interface Float32ArrayConstructor {
436-
new (elements: Iterable<number>): Float32Array;
437-
438-
/**
439-
* Creates an array from an array-like or iterable object.
440-
* @param arrayLike An array-like or iterable object to convert to an array.
441-
* @param mapfn A mapping function to call on every element of the array.
442-
* @param thisArg Value of 'this' used to invoke the mapfn.
443-
*/
444-
from(arrayLike: Iterable<number>, mapfn?: (v: number, k: number) => number, thisArg?: any): Float32Array;
445-
}
446-
447-
interface Float64Array {
448-
[Symbol.iterator](): IterableIterator<number>;
449-
/**
450-
* Returns an array of key, value pairs for every entry in the array
451-
*/
452-
entries(): IterableIterator<[number, number]>;
453-
/**
454-
* Returns an list of keys in the array
455-
*/
456-
keys(): IterableIterator<number>;
457-
/**
458-
* Returns an list of values in the array
459-
*/
460-
values(): IterableIterator<number>;
461-
}
462-
463-
interface Float64ArrayConstructor {
464-
new (elements: Iterable<number>): Float64Array;
465-
466-
/**
467-
* Creates an array from an array-like or iterable object.
468-
* @param arrayLike An array-like or iterable object to convert to an array.
469-
* @param mapfn A mapping function to call on every element of the array.
470-
* @param thisArg Value of 'this' used to invoke the mapfn.
471-
*/
472-
from(arrayLike: Iterable<number>, mapfn?: (v: number, k: number) => number, thisArg?: any): Float64Array;
243+
from(arrayLike: Iterable<number>, mapfn?: (v: number, k: number) => number, thisArg?: any): T;
473244
}

src/lib/es2016.array.include.d.ts

+1-73
Original file line numberDiff line numberDiff line change
@@ -16,79 +16,7 @@ interface ReadonlyArray<T> {
1616
includes(searchElement: T, fromIndex?: number): boolean;
1717
}
1818

19-
interface Int8Array {
20-
/**
21-
* Determines whether an array includes a certain element, returning true or false as appropriate.
22-
* @param searchElement The element to search for.
23-
* @param fromIndex The position in this array at which to begin searching for searchElement.
24-
*/
25-
includes(searchElement: number, fromIndex?: number): boolean;
26-
}
27-
28-
interface Uint8Array {
29-
/**
30-
* Determines whether an array includes a certain element, returning true or false as appropriate.
31-
* @param searchElement The element to search for.
32-
* @param fromIndex The position in this array at which to begin searching for searchElement.
33-
*/
34-
includes(searchElement: number, fromIndex?: number): boolean;
35-
}
36-
37-
interface Uint8ClampedArray {
38-
/**
39-
* Determines whether an array includes a certain element, returning true or false as appropriate.
40-
* @param searchElement The element to search for.
41-
* @param fromIndex The position in this array at which to begin searching for searchElement.
42-
*/
43-
includes(searchElement: number, fromIndex?: number): boolean;
44-
}
45-
46-
interface Int16Array {
47-
/**
48-
* Determines whether an array includes a certain element, returning true or false as appropriate.
49-
* @param searchElement The element to search for.
50-
* @param fromIndex The position in this array at which to begin searching for searchElement.
51-
*/
52-
includes(searchElement: number, fromIndex?: number): boolean;
53-
}
54-
55-
interface Uint16Array {
56-
/**
57-
* Determines whether an array includes a certain element, returning true or false as appropriate.
58-
* @param searchElement The element to search for.
59-
* @param fromIndex The position in this array at which to begin searching for searchElement.
60-
*/
61-
includes(searchElement: number, fromIndex?: number): boolean;
62-
}
63-
64-
interface Int32Array {
65-
/**
66-
* Determines whether an array includes a certain element, returning true or false as appropriate.
67-
* @param searchElement The element to search for.
68-
* @param fromIndex The position in this array at which to begin searching for searchElement.
69-
*/
70-
includes(searchElement: number, fromIndex?: number): boolean;
71-
}
72-
73-
interface Uint32Array {
74-
/**
75-
* Determines whether an array includes a certain element, returning true or false as appropriate.
76-
* @param searchElement The element to search for.
77-
* @param fromIndex The position in this array at which to begin searching for searchElement.
78-
*/
79-
includes(searchElement: number, fromIndex?: number): boolean;
80-
}
81-
82-
interface Float32Array {
83-
/**
84-
* Determines whether an array includes a certain element, returning true or false as appropriate.
85-
* @param searchElement The element to search for.
86-
* @param fromIndex The position in this array at which to begin searching for searchElement.
87-
*/
88-
includes(searchElement: number, fromIndex?: number): boolean;
89-
}
90-
91-
interface Float64Array {
19+
interface TypedArray<T> {
9220
/**
9321
* Determines whether an array includes a certain element, returning true or false as appropriate.
9422
* @param searchElement The element to search for.

0 commit comments

Comments
 (0)