Skip to content

Commit

Permalink
Add failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
fregante committed Nov 16, 2019
1 parent b154f53 commit 2c253ca
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
12 changes: 12 additions & 0 deletions index.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,16 @@ expectType<(string: string) => boolean>(
mem(fn, {cache: new Map<[string], {data: boolean; maxAge: number}>()})
);

/* Overloaded function tests */
function overloadedFn(parameter: false): false;
function overloadedFn(parameter: true): true;
function overloadedFn(parameter: boolean): boolean {
return parameter;
}
expectType<(string: boolean) => boolean>(mem(overloadedFn));
expectType<boolean>(mem(overloadedFn)(true));
expectType<true>(mem(overloadedFn)(true));
expectType<boolean>(mem(overloadedFn)(false));
expectType<false>(mem(overloadedFn)(false));

mem.clear(fn);
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"ava": "^2.4.0",
"delay": "^4.1.0",
"serialize-javascript": "^2.1.0",
"tsd": "^0.10.0",
"tsd": "^0.11.0",
"xo": "^0.25.3"
}
}

0 comments on commit 2c253ca

Please sign in to comment.