Skip to content

Commit

Permalink
Fix defaultMemoize for typescript 2.4 strict generic check
Browse files Browse the repository at this point in the history
  • Loading branch information
Sean Lynch committed Aug 15, 2017
1 parent 5cd0696 commit 5ec2b1f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -953,8 +953,8 @@ export function createSelector<S1, S2, S3, S4, S5, S6, S7, S8, S9, S10, S11, S12
): OutputParametricSelector<S1 & S2 & S3 & S4 & S5 & S6 & S7 & S8 & S9 & S10 & S11 & S12, P1 & P2 & P3 & P4 & P5 & P6 & P7 & P8 & P9 & P10 & P11 & P12, T, (res1: R1, res2: R2, res3: R3, res4: R4, res5: R5, res6: R6, res7: R7, res8: R8, res9: R9, res10: R10, res11: R11, res12: R12) => T>;


export function defaultMemoize<F extends Function>(
func: F, equalityCheck?: <T>(a: T, b: T, index: number) => boolean,
export function defaultMemoize<F extends Function, T>(
func: F, equalityCheck?: (a: T, b: T, index: number) => boolean,
): F;

export function createSelectorCreator(
Expand Down
2 changes: 2 additions & 0 deletions typescript_test/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,8 @@ function testCreateSelectorCreator() {
// typings:expect-error
createSelectorCreator(defaultMemoize, 1);

createSelectorCreator(defaultMemoize, (a: number, b: number) => a === b);

createSelectorCreator(defaultMemoize, <T>(a: T, b: T, index: number) => {
if (index === 0)
return a === b;
Expand Down
5 changes: 2 additions & 3 deletions typescript_test/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"compilerOptions": {
"module": "commonjs",
"noImplicitAny": true,
"strictNullChecks": true
"strict": true
}
}
}

0 comments on commit 5ec2b1f

Please sign in to comment.