From 80c8b9cc63ad81e50381948ac661eed99d5000bb Mon Sep 17 00:00:00 2001 From: Marcin Biernat Date: Thu, 8 Feb 2018 15:34:51 +0100 Subject: [PATCH] Make ramda typings tests pass strict null checks --- types/ramda/index.d.ts | 4 ++-- types/ramda/ramda-tests.ts | 4 ++-- types/ramda/tsconfig.json | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/types/ramda/index.d.ts b/types/ramda/index.d.ts index 4ee63e0975..454d6c49fe 100644 --- a/types/ramda/index.d.ts +++ b/types/ramda/index.d.ts @@ -201,8 +201,8 @@ declare namespace R { * A function that returns the first argument if it's falsy otherwise the second argument. Note that this is * NOT short-circuited, meaning that if expressions are passed they are both evaluated. */ - and any); } | number | boolean | string>(fn1: T, val2: any): boolean; - and any); } | number | boolean | string>(fn1: T): (val2: any) => boolean; + and any); } | number | boolean | string | null>(fn1: T, val2: any): boolean; + and any); } | number | boolean | string | null>(fn1: T): (val2: any) => boolean; /** * Returns true if at least one of elements of the list match the predicate, false otherwise. diff --git a/types/ramda/ramda-tests.ts b/types/ramda/ramda-tests.ts index e6433df004..4a56aea788 100644 --- a/types/ramda/ramda-tests.ts +++ b/types/ramda/ramda-tests.ts @@ -415,7 +415,7 @@ R.times(i, 5); */ () => { function mergeThree(a: number, b: number, c: number): number[] { - return ([]).concat(a, b, c); + return (new Array()).concat(a, b, c); } mergeThree(1, 2, 3); // => [1, 2, 3] @@ -2314,7 +2314,7 @@ class Why { const x0: boolean = R.or(false, true); // => false const x1: number | any[] = R.or(0, []); // => [] const x2: number | any[] = R.or(0)([]); // => [] - const x3: string = R.or(null, ""); // => '' + const x3: string | null = R.or(null, ""); // => '' const why = new Why(true); why.or(true); diff --git a/types/ramda/tsconfig.json b/types/ramda/tsconfig.json index 6be72ef69a..b3781f3314 100644 --- a/types/ramda/tsconfig.json +++ b/types/ramda/tsconfig.json @@ -7,7 +7,7 @@ ], "noImplicitAny": true, "noImplicitThis": false, - "strictNullChecks": false, + "strictNullChecks": true, "strictFunctionTypes": false, "baseUrl": "../", "typeRoots": [ @@ -22,4 +22,4 @@ "index.d.ts", "ramda-tests.ts" ] -} \ No newline at end of file +}