Skip to content

Commit becc613

Browse files
committed
feat!: improve definition for type safety
1 parent d92d0a7 commit becc613

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/node_modules/@stdlib/utils/if-then/docs/types/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
* var z = ifthen( randu() > 0.5, x, y );
4141
* // returns <number>
4242
*/
43-
declare function ifthen( bool: boolean, x: Function, y: Function ): any;
43+
declare function ifthen<T, U>( bool: boolean, x: () => T, y: () => U ): T | U;
4444

4545

4646
// EXPORTS //

lib/node_modules/@stdlib/utils/if-then/docs/types/test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ function zero(): number {
4141

4242
// The function returns the return value of either the `x` or `y` function...
4343
{
44-
ifthen( true, zero, one ); // $ExpectType any
45-
ifthen( false, zero, one ); // $ExpectType any
44+
ifthen( true, zero, one ); // $ExpectType number
45+
ifthen( false, zero, one ); // $ExpectType number
4646
}
4747

4848
// The compiler throws an error if the function is not provided a function as its first argument...

0 commit comments

Comments
 (0)