Skip to content

Commit e8bda28

Browse files
authored
test: add tests for third parameter
Signed-off-by: Athan <[email protected]>
1 parent de708be commit e8bda28

File tree

1 file changed

+12
-0
lines changed
  • lib/node_modules/@stdlib/assert/is-almost-equal/docs/types

1 file changed

+12
-0
lines changed

lib/node_modules/@stdlib/assert/is-almost-equal/docs/types/test.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,18 @@ import isAlmostEqual = require( './index' );
2828
isAlmostEqual( 'beep', 'boop', 2 ); // $ExpectType boolean
2929
}
3030

31+
// The compiler throws an error if the function is provided a third argument which is not a number...
32+
{
33+
isAlmostEqual( 3.14, 3.14, '1' ); // $ExpectError
34+
isAlmostEqual( 3.14, 3.14, true ); // $ExpectError
35+
isAlmostEqual( 3.14, 3.14, false ); // $ExpectError
36+
isAlmostEqual( 3.14, 3.14, null ); // $ExpectError
37+
isAlmostEqual( 3.14, 3.14, undefined ); // $ExpectError
38+
isAlmostEqual( 3.14, 3.14, [] ); // $ExpectError
39+
isAlmostEqual( 3.14, 3.14, {} ); // $ExpectError
40+
isAlmostEqual( 3.14, 3.14, ( x: number ): number => x ); // $ExpectError
41+
}
42+
3143
// The compiler throws an error if the function is provided an unsupported number of arguments...
3244
{
3345
isAlmostEqual(); // $ExpectError

0 commit comments

Comments
 (0)