Skip to content
This repository has been archived by the owner on Jul 25, 2018. It is now read-only.

Commit

Permalink
fix(where): make it less strict (#98)
Browse files Browse the repository at this point in the history
  • Loading branch information
ikatyang authored Aug 10, 2017
1 parent c80ce1a commit 0460185
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 15 deletions.
6 changes: 3 additions & 3 deletions snapshots/ramda-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<any>(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
Expand All @@ -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<number>[]
// @dts-jest:pass -> Dictionary<any>[]
R.filter(R.where({ x: R.equals(10) }), xs); // ==> [{x: 10, y: 2}, {x: 10, y: 4}]
// @dts-jest:pass -> Dictionary<number>[]
// @dts-jest:pass -> Dictionary<any>[]
R.filter(R.where({ x: R.equals(10) }))(xs); // ==> [{x: 10, y: 2}, {x: 10, y: 4}]
})();

Expand Down
4 changes: 2 additions & 2 deletions snapshots/where.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ declare const a_1_b_2_c_3: {
c: 3;
};

// @dts-jest:pass -> (object: Dictionary<number>) => boolean
// @dts-jest:pass -> (object: Dictionary<any>) => boolean
R_where(a_b_c_number_to_boolean);

// @dts-jest:pass -> boolean
Expand All @@ -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<number>) => boolean
// @dts-jest:pass -> (object: Dictionary<any>) => boolean
R_where(dictionary_of_number_to_boolean);

// @dts-jest:pass -> boolean
Expand Down
6 changes: 3 additions & 3 deletions templates/where.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Dictionary, Predicate } from './$types';

export function $<T>(
spec: Dictionary<Predicate<T>>,
object: Dictionary<T>,
export function $(
spec: Dictionary<Predicate<any>>,
object: Dictionary<any>,
): boolean;
8 changes: 4 additions & 4 deletions tests/__snapshots__/ramda-tests.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -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<number>[]"`;
exports[`where R.filter(R.where({ x: R.equals(10) }))(xs) 1`] = `"Dictionary<any>[]"`;
exports[`where R.filter(R.where({ x: R.equals(10) }), xs) 1`] = `"Dictionary<number>[]"`;
exports[`where R.filter(R.where({ x: R.equals(10) }), xs) 1`] = `"Dictionary<any>[]"`;
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"`;
Expand All @@ -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<any>(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<number>) => boolean"`;
Expand Down
4 changes: 2 additions & 2 deletions tests/__snapshots__/where.ts.snap
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`R_where(a_b_c_number_to_boolean) 1`] = `"(object: Dictionary<number>) => boolean"`;
exports[`R_where(a_b_c_number_to_boolean) 1`] = `"(object: Dictionary<any>) => boolean"`;
exports[`R_where(a_b_c_number_to_boolean)(a_1_b_2_c_3) 1`] = `"boolean"`;
Expand All @@ -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<number>) => boolean"`;
exports[`R_where(dictionary_of_number_to_boolean) 1`] = `"(object: Dictionary<any>) => boolean"`;
exports[`R_where(dictionary_of_number_to_boolean)(a_1_b_2_c_3) 1`] = `"boolean"`;
Expand Down
2 changes: 1 addition & 1 deletion tests/ramda-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<any>(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
Expand Down

0 comments on commit 0460185

Please sign in to comment.