Skip to content

Commit

Permalink
feat: use type predicates for narrowing
Browse files Browse the repository at this point in the history
  • Loading branch information
Planeshifter committed Jun 28, 2023
1 parent f3f86f0 commit e2c4238
Show file tree
Hide file tree
Showing 11 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
* var bool = isUint16Array( [] );
* // returns false
*/
declare function isUint16Array( value: any ): boolean;
declare function isUint16Array( value: any ): value is Uint16Array;


// EXPORTS //
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
* var bool = isUint32Array( [] );
* // returns false
*/
declare function isUint32Array( value: any ): boolean;
declare function isUint32Array( value: any ): value is Uint32Array;


// EXPORTS //
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
* var bool = isUint8Array( [] );
* // returns false
*/
declare function isUint8Array( value: any ): boolean;
declare function isUint8Array( value: any ): value is Uint8Array;


// EXPORTS //
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
* var bool = isUint8ClampedArray( [] );
* // returns false
*/
declare function isUint8ClampedArray( value: any ): boolean;
declare function isUint8ClampedArray( value: any ): value is Uint8ClampedArray;


// EXPORTS //
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
* var bool = isUNCPath( '/foo/bar/baz' );
* // returns false
*/
declare function isUNCPath( value: any ): boolean;
declare function isUNCPath( value: any ): value is string;


// EXPORTS //
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
* bool = isUndefinedOrNull( false );
* // returns false
*/
declare function isUndefinedOrNull( value: any ): boolean;
declare function isUndefinedOrNull( value: any ): value is null | undefined;


// EXPORTS //
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
* bool = isUndefined( null );
* // returns false
*/
declare function isUndefined( value: any ): boolean;
declare function isUndefined( value: any ): value is undefined;


// EXPORTS //
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
* var bool = isUnityProbabilityArray( [ 3.14, 0.0 ] );
* // returns false
*/
declare function isUnityProbabilityArray( v: any ): boolean;
declare function isUnityProbabilityArray( v: any ): v is ArrayLike<number>;


// EXPORTS //
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
* var bool = isUppercase( 'salt and light' );
* // returns false
*/
declare function isUppercase( value: any ): boolean;
declare function isUppercase( value: any ): value is string;


// EXPORTS //
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
* var bool = isURIError( {} );
* // returns false
*/
declare function isURIError( value: any ): boolean;
declare function isURIError( value: any ): value is URIError;


// EXPORTS //
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@
* var bool = isURI( 'http://example.w3.org/%at' );
* // returns false
*/
declare function isURI( value: any ): boolean;
declare function isURI( value: any ): value is string;


// EXPORTS //
Expand Down

0 comments on commit e2c4238

Please sign in to comment.