Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(useMap/useSet): better type #2088

Merged
merged 1 commit into from
Mar 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
24 changes: 12 additions & 12 deletions packages/hooks/src/useMap/index.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,22 @@ const [
reset,
get
}
] = useMap(initialValue?: Iterable<[any, any]>);
] = useMap<K, V>(initialValue);
```

### Result

| Property | Description | Type |
| -------- | ---------------- | ---------------------------------------- |
| map | Map object | `Map` |
| set | Add item | `(key: any, value: any) => void` |
| get | Get item | `(key: any) => MapItem` |
| setAll | Set a new Map | `(newMap: Iterable<[any, any]>) => void` |
| remove | Remove key | `(key: any) => void` |
| reset | Reset to default | `() => void` |
| Property | Description | Type |
| -------- | ---------------- | ------------------------------------ |
| map | Map object | `Map<K, V>` |
| set | Add item | `(key: K, value: V) => void` |
| get | Get item | `(key: K) => V \| undefined` |
| setAll | Set a new Map | `(newMap: Iterable<[K, V]>) => void` |
| remove | Remove key | `(key: K) => void` |
| reset | Reset to default | `() => void` |

### Params

| Property | Description | Type | Default |
| ------------ | --------------------------- | ---------------------- | ------- |
| initialValue | Optional, set default value | `Iterable<[any, any]>` | - |
| Property | Description | Type | Default |
| ------------ | --------------------------- | ------------------ | ------- |
| initialValue | Optional, set default value | `Iterable<[K, V]>` | - |
24 changes: 12 additions & 12 deletions packages/hooks/src/useMap/index.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,22 @@ const [
reset,
get
}
] = useMap(initialValue?: Iterable<[any, any]>);
] = useMap<K, V>(initialValue);
```

### Result

| 参数 | 说明 | 类型 |
| ------ | --------------------- | ---------------------------------------- |
| map | Map 对象 | `Map` |
| set | 添加元素 | `(key: any, value: any) => void` |
| get | 获取元素 | `(key: any) => MapItem` |
| setAll | 生成一个新的 Map 对象 | `(newMap: Iterable<[any, any]>) => void` |
| remove | 移除元素 | `(key: any) => void` |
| reset | 重置为默认值 | `() => void` |
| 参数 | 说明 | 类型 |
| ------ | --------------------- | ------------------------------------ |
| map | Map 对象 | `Map<K, V>` |
| set | 添加元素 | `(key: K, value: V) => void` |
| get | 获取元素 | `(key: K) => V \| undefined` |
| setAll | 生成一个新的 Map 对象 | `(newMap: Iterable<[K, V]>) => void` |
| remove | 移除元素 | `(key: K) => void` |
| reset | 重置为默认值 | `() => void` |

### Params

| 参数 | 说明 | 类型 | 默认值 |
| ------------ | --------------------------- | ---------------------- | ------ |
| initialValue | 可选项,传入默认的 Map 参数 | `Iterable<[any, any]>` | - |
| 参数 | 说明 | 类型 | 默认值 |
| ------------ | --------------------------- | ------------------ | ------ |
| initialValue | 可选项,传入默认的 Map 参数 | `Iterable<[K, V]>` | - |
14 changes: 7 additions & 7 deletions packages/hooks/src/useSet/index.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,17 @@ const [
remove,
reset
}
] = useSet(initialValue?: Iterable<K>);
] = useSet<K>(initialValue);
```

### Result

| Property | Description | Type |
| -------- | ---------------- | -------------------- |
| set | Set object | `Set` |
| add | Add item | `(key: any) => void` |
| remove | Remove item | `(key: any) => void` |
| reset | Reset to default | `() => void` |
| Property | Description | Type |
| -------- | ---------------- | ------------------ |
| set | Set object | `Set<K>` |
| add | Add item | `(key: K) => void` |
| remove | Remove item | `(key: K) => void` |
| reset | Reset to default | `() => void` |

### Params

Expand Down
14 changes: 7 additions & 7 deletions packages/hooks/src/useSet/index.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,17 @@ const [
remove,
reset
}
] = useSet(initialValue?: Iterable<K>);
] = useSet<K>(initialValue);
```

### Result

| 参数 | 说明 | 类型 |
| ------ | ------------ | -------------------- |
| set | Set 对象 | `Set` |
| add | 添加元素 | `(key: any) => void` |
| remove | 移除元素 | `(key: any) => void` |
| reset | 重置为默认值 | `() => void` |
| 参数 | 说明 | 类型 |
| ------ | ------------ | ------------------ |
| set | Set 对象 | `Set<K>` |
| add | 添加元素 | `(key: K) => void` |
| remove | 移除元素 | `(key: K) => void` |
| reset | 重置为默认值 | `() => void` |

### Params

Expand Down