Skip to content

Commit fc79d85

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 microsoft#15402
1 parent 49a73a9 commit fc79d85

File tree

4 files changed

+258
-2630
lines changed

4 files changed

+258
-2630
lines changed

src/lib/es2015.iterable.d.ts

Lines changed: 4 additions & 233 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ interface String {
209209
[Symbol.iterator](): IterableIterator<string>;
210210
}
211211

212-
interface Int8Array {
212+
interface TypedArray<T> {
213213
[Symbol.iterator](): IterableIterator<number>;
214214
/**
215215
* Returns an array of key, value pairs for every entry in the array
@@ -225,243 +225,14 @@ interface Int8Array {
225225
values(): IterableIterator<number>;
226226
}
227227

228-
interface Int8ArrayConstructor {
229-
new (elements: Iterable<number>): Int8Array;
228+
interface TypedArrayConstructor<T> {
229+
new (elements: Iterable<number>): T;
230230

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

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

Lines changed: 1 addition & 73 deletions
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)