Skip to main content

isString

A function that checks whether a given argument is a string, and if so, narrows the type of the argument to string.


Code

🔗 View source code

Interface

typescript
const isString: (arg: unknown) => arg is string

Usage

typescript
import { isString } from '@modern-kit/utils';

isString('123'); // true

isString(123); // false
isString(() => {}); // false
isString(true); // false
isString({}); // false
isString([]); // false