docs(isString): Add docs for isString for zh_hans

This commit is contained in:
Sojin Park 2024-08-15 11:09:23 +09:00
parent b11fd69e17
commit 8310cd9d5d
3 changed files with 33 additions and 1 deletions

View File

@ -190,7 +190,7 @@ function sidebar(): DefaultTheme.Sidebar {
{ text: 'isLength', link: '/ko/reference/predicate/isLength' },
{ text: 'isPlainObject', link: '/ko/reference/predicate/isPlainObject' },
{ text: 'isPrimitive', link: '/ko/reference/predicate/isPrimitive' },
{ text: 'isString', link: 'ko/reference/predicate/isString' },
{ text: 'isString', link: '/ko/reference/predicate/isString' },
{ text: 'isMatch (호환성)', link: '/ko/reference/compat/predicate/isMatch' },
{ text: 'matches (호환성)', link: '/ko/reference/compat/predicate/matches' },
{ text: 'matchesProperty (호환성)', link: '/ko/reference/compat/predicate/matchesProperty' },

View File

@ -174,6 +174,7 @@ function sidebar(): DefaultTheme.Sidebar {
{ text: 'isLength', link: '/zh_hans/reference/predicate/isLength' },
{ text: 'isPlainObject', link: '/zh_hans/reference/predicate/isPlainObject' },
{ text: 'isPrimitive', link: '/zh_hans/reference/predicate/isPrimitive' },
{ text: 'isString', link: '/zh_hans/reference/predicate/isString' },
{ text: 'isSymbol', link: '/zh_hans/reference/predicate/isSymbol' },
{ text: 'isMatch (兼容性)', link: '/zh_hans/reference/compat/predicate/isMatch' },
{ text: 'matches (兼容性)', link: '/zh_hans/reference/compat/predicate/matches' },

View File

@ -0,0 +1,31 @@
# isString
检查给定的值是否是一个字符串。
此函数还可以作为 TypeScript 中的类型谓词,将参数的类型缩小为 `string`
## 签名
```typescript
function isString(value: unknown): value is string;
```
### 参数
- `value`(`unknown`): 要测试是否为字符串的值。
### 返回值
- (`x is string`): 如果值是字符串,则返回 `true`,否则返回 `false`
## 示例
```typescript
const value1 = 'abc';
const value2 = 123;
const value3 = true;
console.log(isString(value1)); // true
console.log(isString(value2)); // false
console.log(isString(value3)); // false
```