Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6af8cfd

Browse files
committed
improve examples
1 parent c2d04f7 commit 6af8cfd

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

packages/eslint-plugin/docs/rules/prefer-includes.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ let str: string;
2222
let array: any[];
2323
let readonlyArray: ReadonlyArray<any>;
2424
let typedArray: UInt8Array;
25-
let userDefined: { indexOf(x: any): number; includes(x: any): boolean };
25+
let userDefined: {
26+
indexOf(x: any): number;
27+
includes(x: any): boolean
28+
};
2629

2730
str.indexOf(value) !== -1;
2831
array.indexOf(value) !== -1;
@@ -41,6 +44,10 @@ let array: any[];
4144
let readonlyArray: ReadonlyArray<any>;
4245
let typedArray: UInt8Array;
4346
let userDefined: {
47+
indexOf(x: any): number;
48+
includes(x: any): boolean
49+
};
50+
let mismatchExample: {
4451
indexOf(x: any, fromIndex?: number): number;
4552
includes(x: any): boolean;
4653
};
@@ -49,9 +56,10 @@ str.includes(value);
4956
array.includes(value);
5057
readonlyArray.includes(value);
5158
typedArray.includes(value);
59+
userDefined.includes(value);
5260

5361
// the two methods have different parameters.
54-
userDefined.indexOf(value) >= 0;
62+
mismatchExample.indexOf(value) >= 0;
5563
```
5664

5765
## Options

0 commit comments

Comments
 (0)