array-find-index: Provide this type (#13452)

* array-find-index: Provide `this` type

* Also turn on --strictNullChecks
This commit is contained in:
Andy
2016-12-20 07:51:06 -08:00
committed by GitHub
parent bf173efc58
commit cc92639a4e
4 changed files with 7 additions and 11 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
import * as arrayFindIndex from 'array-find-index';
import arrayFindIndex = require("array-find-index");
arrayFindIndex(['rainbow', 'unicorn', 'pony'], x => x === 'unicorn');
+3 -8
View File
@@ -1,13 +1,8 @@
// Type definitions for array-find-index
// Type definitions for array-find-index 1.0
// Project: https://github.com/sindresorhus/array-find-index
// Definitions by: Sam Verschueren <https://github.com/samverschueren>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare namespace arrayFindIndex {
type Predicate = (element: any, index: number, array: any[]) => boolean;
}
declare function arrayFindIndex(arr: any[], predicate: arrayFindIndex.Predicate): number;
declare function arrayFindIndex(arr: any[], predicate: arrayFindIndex.Predicate, ctx: any): number;
declare function arrayFindIndex<T>(arr: T[], predicate: (element: T, index: number, array: T[]) => boolean): number;
declare function arrayFindIndex<T, U>(arr: T[], predicate: (this: U, element: T, index: number, array: T[]) => boolean, ctx: U): number;
export = arrayFindIndex;
+2 -2
View File
@@ -3,8 +3,8 @@
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"noImplicitThis": false,
"strictNullChecks": false,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
+1
View File
@@ -0,0 +1 @@
{ "extends": "../tslint.json" }