---
title: "isString"
description: "检查一个值是否为字符串的 TypeScript 类型保护函数，可用于运行时类型收窄和输入验证。"
seo_title: "isString"
seo_description: "A TypeScript type guard that checks whether a value is a string, narrowing the type so string methods can be used safely in your code."
canonical_url: "https://core.mhaibaraai.cn/docs/validators/is-string"
---
# isString

> 检查一个值是否为字符串的 TypeScript 类型保护函数，可用于运行时类型收窄和输入验证。

## 用法

检查一个值是否为字符串。这是一个 TypeScript 类型保护函数。

```ts
import { isString } from '@movk/core'

isString('hello') // => true
isString('') // => true
isString(123) // => false
```

## API

`isString(value: any): value is string`

### 参数

**value** (`any`) *required*: 需要检查的值。

### 返回值

**boolean**: 如果值为字符串，则返回 true，否则返回 false。

## Changelog

See commit history for [src/validators/isString.ts](https://github.com/mhaibaraai/movk-core/commits/main/src/validators/isString.ts).


## Sitemap

See the full [sitemap](/sitemap.md) for all pages.
