|
16 | 16 | * limitations under the License.
|
17 | 17 | */
|
18 | 18 |
|
19 |
| - |
20 | 19 | import cuanyByRight = require( './index' );
|
21 | 20 |
|
22 | 21 | /**
|
@@ -57,7 +56,24 @@ function isPositive( value: number ): boolean {
|
57 | 56 | cuanyByRight( new Uint8ClampedArray( [ 1, 2, 3 ] ), isPositive, {} ); // $ExpectType boolean[]
|
58 | 57 | }
|
59 | 58 |
|
60 |
| -// The compiler throws an error if the function is provided a first argument which is not like a function.. |
| 59 | +// The compiler throws an error if the function is provided a first argument which is not an array-like object... |
| 60 | +{ |
| 61 | + cuanyByRight( 1, isPositive ); // $ExpectError |
| 62 | + cuanyByRight( true, isPositive ); // $ExpectError |
| 63 | + cuanyByRight( false, isPositive ); // $ExpectError |
| 64 | + cuanyByRight( null, isPositive ); // $ExpectError |
| 65 | + cuanyByRight( void 0, isPositive ); // $ExpectError |
| 66 | + cuanyByRight( {}, isPositive ); // $ExpectError |
| 67 | + |
| 68 | + cuanyByRight( 1, isPositive, {} ); // $ExpectError |
| 69 | + cuanyByRight( true, isPositive, {} ); // $ExpectError |
| 70 | + cuanyByRight( false, isPositive, {} ); // $ExpectError |
| 71 | + cuanyByRight( null, isPositive, {} ); // $ExpectError |
| 72 | + cuanyByRight( void 0, isPositive, {} ); // $ExpectError |
| 73 | + cuanyByRight( {}, isPositive, {} ); // $ExpectError |
| 74 | +} |
| 75 | + |
| 76 | +// The compiler throws an error if the function is provided a second argument which is not function... |
61 | 77 | {
|
62 | 78 | const x = [ 1, 2, 3, 4 ];
|
63 | 79 |
|
@@ -87,7 +103,7 @@ function isPositive( value: number ): boolean {
|
87 | 103 | const y = [ false, null, false, null, false, null, false, null, false, null ];
|
88 | 104 |
|
89 | 105 | cuanyByRight.assign( x, y, 2, 0, isPositive ); // $ExpectType (boolean | null)[]
|
90 |
| - cuanyByRight.assign( x, y, 2, 0, isPositive, {} ); // $ExpectType (boolean | null)[] |
| 106 | + cuanyByRight.assign( x, y, 2, 0, isPositive, {} ); // $ExpectType (boolean | null)[] |
91 | 107 | cuanyByRight.assign( x, new Float64Array( 4 ), 1, 0, isPositive ); // $ExpectType Float64Array
|
92 | 108 | cuanyByRight.assign( x, new Float32Array( 4 ), 1, 0, isPositive ); // $ExpectType Float32Array
|
93 | 109 | cuanyByRight.assign( x, new Int32Array( 4 ), 1, 0, isPositive ); // $ExpectType Int32Array
|
@@ -148,7 +164,6 @@ function isPositive( value: number ): boolean {
|
148 | 164 | cuanyByRight.assign( x, {}, 2, 0, isPositive, {} ); // $ExpectError
|
149 | 165 | }
|
150 | 166 |
|
151 |
| - |
152 | 167 | // The compiler throws an error if the `assign` method is provided a third argument which is not a number...
|
153 | 168 | {
|
154 | 169 | const x = [ false, false, true, false, false ];
|
@@ -193,7 +208,7 @@ function isPositive( value: number ): boolean {
|
193 | 208 | cuanyByRight.assign( x, y, 1, [], isPositive, {} ); // $ExpectError
|
194 | 209 | }
|
195 | 210 |
|
196 |
| -// The compiler throws an error if the `assign` method is provided a fourth argument which is not like a function... |
| 211 | +// The compiler throws an error if the `assign` method is provided a fifth argument which is not like a function... |
197 | 212 | {
|
198 | 213 | const x = [ false, false, true, false, false ];
|
199 | 214 | const y = [ false, null, false, null, false, null, false, null, false, null ];
|
|
0 commit comments