Skip to content

isString

The isString function checks if the provided value is of type string.

Syntax

typescript
isString(value: any): value is string;

Parameters

ParameterTypeDescription
valueanyValue to be checked

Returns

TypeDescription
booleanTrue if it is a string

Examples

typescript
isString("abc"); // => true
isString(123); // => false

Notes

  • Useful for validating values before performing string operations.

References

Released under the MIT License.