Skip to content

Commit 30112b7

Browse files
committed
fix: replace use of type guards with boolean return type
The type narrowing behavior of type guards makes only sense when the runtime checks match the type guards. For example `value is string` should be used with `typeof value === 'string'` and not with a function that checks for whether a value is a snakecase string. In the latter case, the type guard would incorrectly narrow the type of the value to `never` for a string that is not snakecase.
1 parent 670aeab commit 30112b7

File tree

33 files changed

+41
-41
lines changed

33 files changed

+41
-41
lines changed

lib/node_modules/@stdlib/assert/is-absolute-http-uri/docs/types/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
* var bool = isAbsoluteHttpURI( null );
4949
* // returns false
5050
*/
51-
declare function isAbsoluteHttpURI( value: any ): value is string;
51+
declare function isAbsoluteHttpURI( value: any ): boolean;
5252

5353

5454
// EXPORTS //

lib/node_modules/@stdlib/assert/is-absolute-path/docs/types/index.d.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ interface IsAbsolutePath {
3939
* // returns true
4040
* }
4141
*/
42-
( value: any ): value is string;
42+
( value: any ): boolean;
4343

4444
/**
4545
* Tests if a value is a POSIX absolute path.
@@ -55,7 +55,7 @@ interface IsAbsolutePath {
5555
* var bool = isAbsolutePath.posix( 'foo/bar/baz' );
5656
* // returns false
5757
*/
58-
posix( value: any ): value is string;
58+
posix( value: any ): boolean;
5959

6060
/**
6161
* Tests if a value is a Windows absolute path.
@@ -71,7 +71,7 @@ interface IsAbsolutePath {
7171
* var bool = isAbsolutePath.win32( 'foo\\bar\\baz' );
7272
* // returns false
7373
*/
74-
win32( value: any ): value is string;
74+
win32( value: any ): boolean;
7575
}
7676

7777
/**

lib/node_modules/@stdlib/assert/is-absolute-uri/docs/types/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
* var bool = isAbsoluteURI( null );
4545
* // returns false
4646
*/
47-
declare function isAbsoluteURI( value: any ): value is string;
47+
declare function isAbsoluteURI( value: any ): boolean;
4848

4949

5050
// EXPORTS //

lib/node_modules/@stdlib/assert/is-alphagram/docs/types/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
* var out = isAlphagram( 123 );
4949
* // returns false
5050
*/
51-
declare function isAlphagram( value: any ): value is string;
51+
declare function isAlphagram( value: any ): boolean;
5252

5353

5454
// EXPORTS //

lib/node_modules/@stdlib/assert/is-alphanumeric/docs/types/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
* var out = isAlphaNumeric( 123 );
4545
* // returns false
4646
*/
47-
declare function isAlphaNumeric( value: any ): value is string;
47+
declare function isAlphaNumeric( value: any ): boolean;
4848

4949

5050
// EXPORTS //

lib/node_modules/@stdlib/assert/is-ascii/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 out = isASCII( 123 );
4141
* // returns false
4242
*/
43-
declare function isASCII( value: any ): value is string;
43+
declare function isASCII( value: any ): boolean;
4444

4545

4646
// EXPORTS //

lib/node_modules/@stdlib/assert/is-binary-string/docs/types/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
* var bool = isBinaryString( '' );
3737
* // returns false
3838
*/
39-
declare function isBinaryString( value: any ): value is string;
39+
declare function isBinaryString( value: any ): boolean;
4040

4141

4242
// EXPORTS //

lib/node_modules/@stdlib/assert/is-blank-string/docs/types/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
* var bool = isBlankString( 'beep' );
4545
* // returns false
4646
*/
47-
declare function isBlankString( value: any ): value is string;
47+
declare function isBlankString( value: any ): boolean;
4848

4949

5050
// EXPORTS //

lib/node_modules/@stdlib/assert/is-camelcase/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 bool = isCamelcase( 'hello world' );
4141
* // returns false
4242
*/
43-
declare function isCamelcase( value: any ): value is string;
43+
declare function isCamelcase( value: any ): boolean;
4444

4545

4646
// EXPORTS //

lib/node_modules/@stdlib/assert/is-capitalized/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 bool = isCapitalized( 'salt and light' );
4141
* // returns false
4242
*/
43-
declare function isCapitalized( value: any ): value is string;
43+
declare function isCapitalized( value: any ): boolean;
4444

4545

4646
// EXPORTS //

0 commit comments

Comments
 (0)