Skip to content

Commit 76a5b69

Browse files
committed
feat: better Array#includes uhyo#17
1 parent f8964af commit 76a5b69

File tree

5 files changed

+189
-162
lines changed

5 files changed

+189
-162
lines changed

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

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,29 @@ interface Array<T> {
44
* @param searchElement The element to search for.
55
* @param fromIndex The position in this array at which to begin searching for searchElement.
66
*/
7-
includes(searchElement: T, fromIndex?: number): boolean;
7+
includes(searchElement: unknown, fromIndex?: number): searchElement is T;
88
}
9+
// /**
10+
// * Determines whether an array includes a certain element, returning true or false as appropriate.
11+
// * @param searchElement The element to search for.
12+
// * @param fromIndex The position in this array at which to begin searching for searchElement.
13+
// */
14+
// includes(searchElement: T, fromIndex?: number): boolean;
915

1016
interface ReadonlyArray<T> {
1117
/**
1218
* Determines whether an array includes a certain element, returning true or false as appropriate.
1319
* @param searchElement The element to search for.
1420
* @param fromIndex The position in this array at which to begin searching for searchElement.
1521
*/
16-
includes(searchElement: T, fromIndex?: number): boolean;
22+
includes(searchElement: unknown, fromIndex?: number): searchElement is T;
1723
}
24+
// /**
25+
// * Determines whether an array includes a certain element, returning true or false as appropriate.
26+
// * @param searchElement The element to search for.
27+
// * @param fromIndex The position in this array at which to begin searching for searchElement.
28+
// */
29+
// includes(searchElement: T, fromIndex?: number): boolean;
1830

1931
interface Int8Array {
2032
/**

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

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
interface Array<T> {
2+
/**
3+
* Determines whether an array includes a certain element, returning true or false as appropriate.
4+
* @param searchElement The element to search for.
5+
* @param fromIndex The position in this array at which to begin searching for searchElement.
6+
*/
7+
includes(searchElement: unknown, fromIndex?: number): searchElement is T;
8+
}
9+
10+
interface ReadonlyArray<T> {
11+
/**
12+
* Determines whether an array includes a certain element, returning true or false as appropriate.
13+
* @param searchElement The element to search for.
14+
* @param fromIndex The position in this array at which to begin searching for searchElement.
15+
*/
16+
includes(searchElement: unknown, fromIndex?: number): searchElement is T;
17+
}

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)