|
| 1 | +/* |
| 2 | +* @license Apache-2.0 |
| 3 | +* |
| 4 | +* Copyright (c) 2024 The Stdlib Authors. |
| 5 | +* |
| 6 | +* Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | +* you may not use this file except in compliance with the License. |
| 8 | +* You may obtain a copy of the License at |
| 9 | +* |
| 10 | +* http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | +* |
| 12 | +* Unless required by applicable law or agreed to in writing, software |
| 13 | +* distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | +* See the License for the specific language governing permissions and |
| 16 | +* limitations under the License. |
| 17 | +*/ |
| 18 | + |
| 19 | +import mskreject = require( './index' ); |
| 20 | + |
| 21 | + |
| 22 | +// TESTS // |
| 23 | + |
| 24 | +// The function returns an array... |
| 25 | +{ |
| 26 | + mskreject( [ 1, 2, 3, 4 ], [ 0, 0, 0, 0 ] ); // $ExpectType number[] |
| 27 | + mskreject<any>( [ 1, 2, 3, 4 ], [ 0, 0, 0, 0 ] ); // $ExpectType any[] |
| 28 | + mskreject<number>( [ 1, 2, 3, 4 ], [ 0, 0, 0, 0 ] ); // $ExpectType number[] |
| 29 | + mskreject<string>( [ '1', '2', '3', '4' ], [ 0, 0, 0, 0 ] ); // $ExpectType string[] |
| 30 | +} |
| 31 | + |
| 32 | +// The compiler throws an error if the function is provided a first argument which is not an array-like object... |
| 33 | +{ |
| 34 | + mskreject( 1, [ 0, 0 ] ); // $ExpectError |
| 35 | + mskreject( true, [ 0, 0 ] ); // $ExpectError |
| 36 | + mskreject( false, [ 0, 0 ] ); // $ExpectError |
| 37 | + mskreject( null, [ 0, 0 ] ); // $ExpectError |
| 38 | + mskreject( void 0, [ 0, 0 ] ); // $ExpectError |
| 39 | + mskreject( {}, [ 0, 0 ] ); // $ExpectError |
| 40 | +} |
| 41 | + |
| 42 | +// The compiler throws an error if the function is provided a second argument which is not an array-like object containing numbers... |
| 43 | +{ |
| 44 | + mskreject( [], 1 ); // $ExpectError |
| 45 | + mskreject( [], true ); // $ExpectError |
| 46 | + mskreject( [], false ); // $ExpectError |
| 47 | + mskreject( [], null ); // $ExpectError |
| 48 | + mskreject( [], void 0 ); // $ExpectError |
| 49 | + mskreject( [], {} ); // $ExpectError |
| 50 | +} |
| 51 | + |
| 52 | +// The compiler throws an error if the function is provided an unsupported number of arguments... |
| 53 | +{ |
| 54 | + mskreject(); // $ExpectError |
| 55 | + mskreject( [] ); // $ExpectError |
| 56 | + mskreject( [], [], [] ); // $ExpectError |
| 57 | +} |
0 commit comments