From 979f06e302401f013ecdedd9c7625246dacf5b7b Mon Sep 17 00:00:00 2001 From: ikatyang Date: Thu, 10 Aug 2017 19:20:28 +0800 Subject: [PATCH] fix(where): make it less strict --- snapshots/ramda-tests.ts | 6 +++--- snapshots/where.ts | 4 ++-- templates/where.d.ts | 6 +++--- tests/__snapshots__/ramda-tests.ts.snap | 8 ++++---- tests/__snapshots__/where.ts.snap | 4 ++-- tests/ramda-tests.ts | 2 +- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/snapshots/ramda-tests.ts b/snapshots/ramda-tests.ts index 6763978..49f6bf1 100644 --- a/snapshots/ramda-tests.ts +++ b/snapshots/ramda-tests.ts @@ -3219,7 +3219,7 @@ import * as R from '../ramda/dist/index'; // @dts-jest:pass -> boolean R.where(spec)({ w: 10, x: 2, y: 300 }); //=> true // @dts-jest:pass -> boolean - R.where(spec)({ x: 1, y: 'moo', z: true }); //=> false + R.where(spec)({ x: 1, y: 'moo', z: true }); //=> false const spec2 = { x: (val: number) => val > 10 }; // @dts-jest:pass -> boolean @@ -3228,9 +3228,9 @@ import * as R from '../ramda/dist/index'; R.where(spec2, { x: 3, y: 8 }); //=> true const xs = [{ x: 2, y: 1 }, { x: 10, y: 2 }, { x: 8, y: 3 }, { x: 10, y: 4 }]; - // @dts-jest:pass -> Dictionary[] + // @dts-jest:pass -> Dictionary[] R.filter(R.where({ x: R.equals(10) }), xs); // ==> [{x: 10, y: 2}, {x: 10, y: 4}] - // @dts-jest:pass -> Dictionary[] + // @dts-jest:pass -> Dictionary[] R.filter(R.where({ x: R.equals(10) }))(xs); // ==> [{x: 10, y: 2}, {x: 10, y: 4}] })(); diff --git a/snapshots/where.ts b/snapshots/where.ts index b69020e..f930737 100644 --- a/snapshots/where.ts +++ b/snapshots/where.ts @@ -16,7 +16,7 @@ declare const a_1_b_2_c_3: { c: 3; }; -// @dts-jest:pass -> (object: Dictionary) => boolean +// @dts-jest:pass -> (object: Dictionary) => boolean R_where(a_b_c_number_to_boolean); // @dts-jest:pass -> boolean @@ -29,7 +29,7 @@ R_where(a_b_c_number_to_boolean)(number_dictionary); // @dts-jest:pass -> boolean R_where(a_b_c_number_to_boolean, number_dictionary); -// @dts-jest:pass -> (object: Dictionary) => boolean +// @dts-jest:pass -> (object: Dictionary) => boolean R_where(dictionary_of_number_to_boolean); // @dts-jest:pass -> boolean diff --git a/templates/where.d.ts b/templates/where.d.ts index 120fc05..54a66ba 100644 --- a/templates/where.d.ts +++ b/templates/where.d.ts @@ -1,6 +1,6 @@ import { Dictionary, Predicate } from './$types'; -export function $( - spec: Dictionary>, - object: Dictionary, +export function $( + spec: Dictionary>, + object: Dictionary, ): boolean; diff --git a/tests/__snapshots__/ramda-tests.ts.snap b/tests/__snapshots__/ramda-tests.ts.snap index 42a5616..e8cf6fd 100644 --- a/tests/__snapshots__/ramda-tests.ts.snap +++ b/tests/__snapshots__/ramda-tests.ts.snap @@ -1460,12 +1460,14 @@ exports[`when truncate('0123456789ABC') 1`] = `"string"`; exports[`when truncate('12345') 1`] = `"string"`; -exports[`where R.filter(R.where({ x: R.equals(10) }))(xs) 1`] = `"Dictionary[]"`; +exports[`where R.filter(R.where({ x: R.equals(10) }))(xs) 1`] = `"Dictionary[]"`; -exports[`where R.filter(R.where({ x: R.equals(10) }), xs) 1`] = `"Dictionary[]"`; +exports[`where R.filter(R.where({ x: R.equals(10) }), xs) 1`] = `"Dictionary[]"`; exports[`where R.where(spec)({ w: 10, x: 2, y: 300 }) 1`] = `"boolean"`; +exports[`where R.where(spec)({ x: 1, y: 'moo', z: true }) 1`] = `"boolean"`; + exports[`where R.where(spec, { w: 10, x: 2, y: 300 }) 1`] = `"boolean"`; exports[`where R.where(spec, { x: 1, y: 'moo', z: true }) 1`] = `"boolean"`; @@ -1474,8 +1476,6 @@ exports[`where R.where(spec2, { x: 2, y: 7 }) 1`] = `"boolean"`; exports[`where R.where(spec2, { x: 3, y: 8 }) 1`] = `"boolean"`; -exports[`where R.where(spec)({ x: 1, y: 'moo', z: true }) 1`] = `"boolean"`; - exports[`whereEq R.whereEq({ a: 'one' }, { a: 'one' }) 1`] = `"boolean"`; exports[`whereEq pred 1`] = `"(object: Dictionary) => boolean"`; diff --git a/tests/__snapshots__/where.ts.snap b/tests/__snapshots__/where.ts.snap index 8e1009b..9fe35ee 100644 --- a/tests/__snapshots__/where.ts.snap +++ b/tests/__snapshots__/where.ts.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`R_where(a_b_c_number_to_boolean) 1`] = `"(object: Dictionary) => boolean"`; +exports[`R_where(a_b_c_number_to_boolean) 1`] = `"(object: Dictionary) => boolean"`; exports[`R_where(a_b_c_number_to_boolean)(a_1_b_2_c_3) 1`] = `"boolean"`; @@ -10,7 +10,7 @@ exports[`R_where(a_b_c_number_to_boolean, a_1_b_2_c_3) 1`] = `"boolean"`; exports[`R_where(a_b_c_number_to_boolean, number_dictionary) 1`] = `"boolean"`; -exports[`R_where(dictionary_of_number_to_boolean) 1`] = `"(object: Dictionary) => boolean"`; +exports[`R_where(dictionary_of_number_to_boolean) 1`] = `"(object: Dictionary) => boolean"`; exports[`R_where(dictionary_of_number_to_boolean)(a_1_b_2_c_3) 1`] = `"boolean"`; diff --git a/tests/ramda-tests.ts b/tests/ramda-tests.ts index 63d80ba..1d727cf 100644 --- a/tests/ramda-tests.ts +++ b/tests/ramda-tests.ts @@ -3219,7 +3219,7 @@ import * as R from '../ramda/dist/index'; // @dts-jest:pass R.where(spec)({ w: 10, x: 2, y: 300 }); //=> true // @dts-jest:pass - R.where(spec)({ x: 1, y: 'moo', z: true }); //=> false + R.where(spec)({ x: 1, y: 'moo', z: true }); //=> false const spec2 = { x: (val: number) => val > 10 }; // @dts-jest:pass