fix(compat): fix type error (#729)
Some checks failed
CI / codecov (push) Has been cancelled
Release / release (push) Has been cancelled

This commit is contained in:
D-Sketon 2024-10-21 11:10:37 +08:00 committed by GitHub
parent e71f706461
commit 4a8ea44edd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
15 changed files with 30 additions and 30 deletions

View File

@ -29,7 +29,7 @@ function every<T extends Record<string, unknown>>(
doesMatch: (value: T[keyof T], key: keyof T, object: T) => unknown
): boolean;
function every<T extends Record<string, unknown>>(object: T, doesMatch: Partial<T[keyof T]>): boolean;
function every<T extends Record<string, unknown>>(object: T, doesMatch: [keyof T, unknown]): boolean;
function every<T extends Record<string, unknown>>(object: T, doesMatch: [keyof T[keyof T], unknown]): boolean;
function every<T extends Record<string, unknown>>(object: T, doesMatch: string): boolean;
```
@ -66,7 +66,7 @@ lodash と完全に互換性があるように、`every` 関数は `object` を
- オブジェクトの場合:
- **検査関数** (`(value: T[keyof T], key: keyof T, object: T) => unknown`): 条件を満たすかどうかを確認する関数。すべての要素が条件を満たす場合、結果は `true` になります。
- **部分値** (`Partial<T[keyof T]>`): 与えられた部分値に一致する場合、すべての要素が条件を満たす必要があります。
- **プロパティ-値ペア** (`[keyof T, unknown]`): 最初が一致させるプロパティ、2番目が一致させる値を表すタプル。すべての要素がこの条件を満たす場合、結果は `true` になります。
- **プロパティ-値ペア** (`[keyof T[keyof T], unknown]`): 最初が一致させるプロパティ、2番目が一致させる値を表すタプル。すべての要素がこの条件を満たす場合、結果は `true` になります。
- **プロパティ名** (`string`): 指定されたプロパティがすべての要素に対して真と評価される場合、結果は `true` になります。
### 戻り値

View File

@ -28,7 +28,7 @@ function filter<T extends Record<string, unknown>>(
doesMatch: (value: T[keyof T], key: keyof T, object: T) => unknown
): T[];
function filter<T extends Record<string, unknown>>(object: T, doesMatch: Partial<T[keyof T]>): T[];
function filter<T extends Record<string, unknown>>(object: T, doesMatch: [keyof T, unknown]): T[];
function filter<T extends Record<string, unknown>>(object: T, doesMatch: [keyof T[keyof T], unknown]): T[];
function filter<T extends Record<string, unknown>>(object: T, doesMatch: string): T[];
```
@ -58,7 +58,7 @@ lodash と完全に互換性を保つため、`filter` 関数は `arr` を次の
- **検査関数** (`(value: T[keyof T], key: keyof T, object: T) => unknown`): 各要素が条件を満たしているか確認する関数。
- **部分値** (`Partial<T[keyof T]>`): 要素の属性と値が一致するか確認する部分オブジェクト。
- **プロパティ-値ペア** (`[keyof T, unknown]`): 最初の要素が対象プロパティ、2番目が対象値を示すタプル。
- **プロパティ-値ペア** (`[keyof T[keyof T], unknown]`): 最初の要素が対象プロパティ、2番目が対象値を示すタプル。
- **プロパティ名** (`string`): 特定の属性を持っているか確認するプロパティ名。
### 戻り値

View File

@ -28,7 +28,7 @@ function find<T extends Record<string, unknown>>(
doesMatch: (item: T[keyof T], index: number, object: T) => unknown
): T | undefined;
function find<T extends Record<string, unknown>>(object: T, doesMatch: Partial<T[keyof T]>): T | undefined;
function find<T extends Record<string, unknown>>(object: T, doesMatch: [keyof T, unknown]): T | undefined;
function find<T extends Record<string, unknown>>(object: T, doesMatch: [keyof T[keyof T], unknown]): T | undefined;
function find<T extends Record<string, unknown>>(object: T, doesMatch: string): T | undefined;
```
@ -65,7 +65,7 @@ lodash と完全に互換性があるように、`find` 関数は `object` を
- オブジェクトの場合:
- **検査関数** (`(item: T[keyof T], index: number, object: T) => unknown`): 探している要素かどうかを返す関数。
- **部分値** (`Partial<T[keyof T]>`): 一致させるプロパティと値を指定した部分オブジェクト。
- **プロパティ-値ペア** (`[keyof T, unknown]`): 最初が一致させるプロパティ、2番目が一致させる値を表すタプル。
- **プロパティ-値ペア** (`[keyof T[keyof T], unknown]`): 最初が一致させるプロパティ、2番目が一致させる値を表すタプル。
- **プロパティ名** (`string`): 真と評価される値を持っているか確認するプロパティ名。
### 戻り値

View File

@ -29,7 +29,7 @@ function every<T extends Record<string, unknown>>(
doesMatch: (value: T[keyof T], key: keyof T, object: T) => unknown
): boolean;
function every<T extends Record<string, unknown>>(object: T, doesMatch: Partial<T[keyof T]>): boolean;
function every<T extends Record<string, unknown>>(object: T, doesMatch: [keyof T, unknown]): boolean;
function every<T extends Record<string, unknown>>(object: T, doesMatch: [keyof T[keyof T], unknown]): boolean;
function every<T extends Record<string, unknown>>(object: T, doesMatch: string): boolean;
```
@ -66,7 +66,7 @@ lodash와 완벽하게 호환되도록 `every` 함수는 `object`를 다음과
- 객체의 경우:
- **검사 함수** (`(value: T[keyof T], key: keyof T, object: T) => unknown`): 모든 요소가 조건을 만족하는지 확인하는 함수.
- **Partial value** (`Partial<T[keyof T]>`): 모든 요소가 주어진 부분 값에 일치해야 `true`를 반환하는 객체.
- **Property-value pair** (`[keyof T, unknown]`): 첫 번째가 일치시킬 프로퍼티, 두 번째가 일치시킬 값을 나타내는 튜플로, 모든 요소가 이 조건을 만족해야 `true`를 반환.
- **Property-value pair** (`[keyof T[keyof T], unknown]`): 첫 번째가 일치시킬 프로퍼티, 두 번째가 일치시킬 값을 나타내는 튜플로, 모든 요소가 이 조건을 만족해야 `true`를 반환.
- **Property name** (`string`): 모든 요소가 해당 프로퍼티에 대해 참으로 평가되는 값을 가져야 `true`를 반환.
### 반환 값

View File

@ -28,7 +28,7 @@ function filter<T extends Record<string, unknown>>(
doesMatch: (value: T[keyof T], key: keyof T, object: T) => unknown
): T[];
function filter<T extends Record<string, unknown>>(object: T, doesMatch: Partial<T[keyof T]>): T[];
function filter<T extends Record<string, unknown>>(object: T, doesMatch: [keyof T, unknown]): T[];
function filter<T extends Record<string, unknown>>(object: T, doesMatch: [keyof T[keyof T], unknown]): T[];
function filter<T extends Record<string, unknown>>(object: T, doesMatch: string): T[];
```
@ -58,7 +58,7 @@ lodash와 완벽하게 호환되도록 `filter` 함수는 `arr`을 다음과 같
- **검사 함수** (`(value: T[keyof T], key: keyof T, object: T) => unknown`): 각 요소가 조건을 만족하는지 확인하는 함수.
- **부분 객체** (`Partial<T[keyof T]>`): 요소의 속성과 값과 일치하는지 확인할 부분 객체.
- **프로퍼티-값 쌍** (`[keyof T, unknown]`): 첫 번째가 찾는 프로퍼티, 두 번째가 찾는 값을 나타내는 튜플.
- **프로퍼티-값 쌍** (`[keyof T[keyof T], unknown]`): 첫 번째가 찾는 프로퍼티, 두 번째가 찾는 값을 나타내는 튜플.
- **프로퍼티 이름** (`string`): 특정 속성을 가지고 있는지 확인할 프로퍼티 이름.
### 반환 값

View File

@ -28,7 +28,7 @@ function find<T extends Record<string, unknown>>(
doesMatch: (item: T[keyof T], index: number, object: T) => unknown
): T | undefined;
function find<T extends Record<string, unknown>>(object: T, doesMatch: Partial<T[keyof T]>): T | undefined;
function find<T extends Record<string, unknown>>(object: T, doesMatch: [keyof T, unknown]): T | undefined;
function find<T extends Record<string, unknown>>(object: T, doesMatch: [keyof T[keyof T], unknown]): T | undefined;
function find<T extends Record<string, unknown>>(object: T, doesMatch: string): T | undefined;
```
@ -65,7 +65,7 @@ lodash와 완벽하게 호환되도록 `find` 함수는 `object`를 다음과
- 객체의 경우:
- **검사 함수** (`(item: T[keyof T], index: number, object: T) => unknown`): 찾는 요소인지 여부를 반환하는 함수.
- **Partial value** (`Partial<T[keyof T]>`): 일치시킬 프로퍼티와 값들을 명시한 부분 객체.
- **Property-value pair** (`[keyof T, unknown]`): 첫 번째가 일치시킬 프로퍼티, 두 번째가 일치시킬 값을 나타내는 튜플.
- **Property-value pair** (`[keyof T[keyof T], unknown]`): 첫 번째가 일치시킬 프로퍼티, 두 번째가 일치시킬 값을 나타내는 튜플.
- **Property name** (`string`): 참으로 평가되는 값을 가지고 있는지 확인할 프로퍼티 이름.
### 반환 값

View File

@ -29,7 +29,7 @@ function every<T extends Record<string, unknown>>(
doesMatch: (value: T[keyof T], key: keyof T, object: T) => unknown
): boolean;
function every<T extends Record<string, unknown>>(object: T, doesMatch: Partial<T[keyof T]>): boolean;
function every<T extends Record<string, unknown>>(object: T, doesMatch: [keyof T, unknown]): boolean;
function every<T extends Record<string, unknown>>(object: T, doesMatch: [keyof T[keyof T], unknown]): boolean;
function every<T extends Record<string, unknown>>(object: T, doesMatch: string): boolean;
```
@ -66,7 +66,7 @@ To ensure full compatibility with lodash, the every function handles `object` in
- For the `every` overloads with objects:
- **Predicate function** (`(value: T[keyof T], key: keyof T, object: T) => unknown`): A function that takes an value, its key, and the object, and returns a truthy value if the item matches the criteria.
- **Partial value** (`Partial<T[keyof T]>`): A partial value to match against the values of the object.
- **Property-value pair** (`[keyof T, unknown]`): An array where the first element is the property key and the second element is the value to match.
- **Property-value pair** (`[keyof T[keyof T], unknown]`): An array where the first element is the property key and the second element is the value to match.
- **Property name** (`string`): The name of the property to check for a truthy value.
### Returns

View File

@ -28,7 +28,7 @@ function filter<T extends Record<string, unknown>>(
doesMatch: (value: T[keyof T], key: keyof T, object: T) => unknown
): T[];
function filter<T extends Record<string, unknown>>(object: T, doesMatch: Partial<T[keyof T]>): T[];
function filter<T extends Record<string, unknown>>(object: T, doesMatch: [keyof T, unknown]): T[];
function filter<T extends Record<string, unknown>>(object: T, doesMatch: [keyof T[keyof T], unknown]): T[];
function filter<T extends Record<string, unknown>>(object: T, doesMatch: string): T[];
```
@ -57,7 +57,7 @@ To ensure full compatibility with lodash, the `filter` function handles `arr` in
- For the `filter` overloads with objects:
- **Predicate function** (`(value: T[keyof T], key: keyof T, object: T) => unknown`): A function that takes an value, its key, and the object, and returns a truthy value if the item matches the criteria.
- **Partial value** (`Partial<T[keyof T]>`): A partial value to match against the values of the object.
- **Property-value pair** (`[keyof T, unknown]`): An array where the first element is the property key and the second element is the value to match.
- **Property-value pair** (`[keyof T[keyof T], unknown]`): An array where the first element is the property key and the second element is the value to match.
- **Property name** (`string`): The name of the property to check for a truthy value.
### Returns

View File

@ -28,7 +28,7 @@ function find<T extends Record<string, unknown>>(
doesMatch: (item: T[keyof T], index: number, object: T) => unknown
): T | undefined;
function find<T extends Record<string, unknown>>(object: T, doesMatch: Partial<T[keyof T]>): T | undefined;
function find<T extends Record<string, unknown>>(object: T, doesMatch: [keyof T, unknown]): T | undefined;
function find<T extends Record<string, unknown>>(object: T, doesMatch: [keyof T[keyof T], unknown]): T | undefined;
function find<T extends Record<string, unknown>>(object: T, doesMatch: string): T | undefined;
```
@ -65,7 +65,7 @@ To ensure full compatibility with lodash, the `find` function handles `object` i
- For the `find` overloads with objects:
- **Predicate function** (`(item: T[keyof T], index: number, object: T) => unknown`): A function that takes an item, its key, and the object, and returns a truthy value if the item matches the criteria.
- **Partial value** (`Partial<T[keyof T]>`): A partial value to match against the values of the object.
- **Property-value pair** (`[keyof T, unknown]`): An array where the first element is the property key and the second element is the value to match.
- **Property-value pair** (`[keyof T[keyof T], unknown]`): An array where the first element is the property key and the second element is the value to match.
- **Property name** (`string`): The name of the property to check for a truthy value.
### Returns

View File

@ -30,7 +30,7 @@ function every<T extends Record<string, unknown>>(
doesMatch: (value: T[keyof T], key: keyof T, object: T) => unknown
): boolean;
function every<T extends Record<string, unknown>>(object: T, doesMatch: Partial<T[keyof T]>): boolean;
function every<T extends Record<string, unknown>>(object: T, doesMatch: [keyof T, unknown]): boolean;
function every<T extends Record<string, unknown>>(object: T, doesMatch: [keyof T[keyof T], unknown]): boolean;
function every<T extends Record<string, unknown>>(object: T, doesMatch: string): boolean;
```
@ -67,7 +67,7 @@ function every<T extends Record<string, unknown>>(object: T, doesMatch: string):
- 对于对象的 `every` 重载:
- **检查函数** (`(value: T[keyof T], key: keyof T, object: T) => unknown`): 一个函数,接受项、其键和对象,如果所有项都符合条件则返回 `true`
- **部分值** (`Partial<T[keyof T]>`): 用于与对象的值进行匹配的部分值,所有项必须匹配这些值。
- **属性-值对** (`[keyof T, unknown]`): 一个数组,第一个元素是属性键,第二个元素是要匹配的值,所有项必须匹配该属性和值。
- **属性-值对** (`[keyof T[keyof T], unknown]`): 一个数组,第一个元素是属性键,第二个元素是要匹配的值,所有项必须匹配该属性和值。
- **属性名称** (`string`): 要检查其真值的属性名称,所有项必须具有该属性且其值为真。
### 返回

View File

@ -29,7 +29,7 @@ function filter<T extends Record<string, unknown>>(
doesMatch: (value: T[keyof T], key: keyof T, object: T) => unknown
): T[];
function filter<T extends Record<string, unknown>>(object: T, doesMatch: Partial<T[keyof T]>): T[];
function filter<T extends Record<string, unknown>>(object: T, doesMatch: [keyof T, unknown]): T[];
function filter<T extends Record<string, unknown>>(object: T, doesMatch: [keyof T[keyof T], unknown]): T[];
function filter<T extends Record<string, unknown>>(object: T, doesMatch: string): T[];
```
@ -58,7 +58,7 @@ function filter<T extends Record<string, unknown>>(object: T, doesMatch: string)
- 对于对象的 `filter` 重载:
- **谓词函数** (`(value: T[keyof T], key: keyof T, object: T) => unknown`): 一个函数,接收一个项、其键和对象,如果该项符合条件,则返回一个真值。
- **部分值** (`Partial<T[keyof T]>`): 用于检查元素的属性和值是否匹配的部分对象。
- **属性-值对** (`[keyof T, unknown]`): 一个数组,第一个元素是属性键,第二个元素是要匹配的值。
- **属性-值对** (`[keyof T[keyof T], unknown]`): 一个数组,第一个元素是属性键,第二个元素是要匹配的值。
- **属性名称** (`string`): 用于检查是否具有特定属性的属性名称。
### 返回

View File

@ -29,7 +29,7 @@ function find<T extends Record<string, unknown>>(
doesMatch: (item: T[keyof T], index: number, object: T) => unknown
): T | undefined;
function find<T extends Record<string, unknown>>(object: T, doesMatch: Partial<T[keyof T]>): T | undefined;
function find<T extends Record<string, unknown>>(object: T, doesMatch: [keyof T, unknown]): T | undefined;
function find<T extends Record<string, unknown>>(object: T, doesMatch: [keyof T[keyof T], unknown]): T | undefined;
function find<T extends Record<string, unknown>>(object: T, doesMatch: string): T | undefined;
```
@ -66,7 +66,7 @@ function find<T extends Record<string, unknown>>(object: T, doesMatch: string):
- 对于对象的 `find` 重载:
- **谓词函数** (`(item: T[keyof T], index: number, object: T) => unknown`): 一个函数,接受项、其键和对象,如果项符合条件则返回真值。
- **部分值** (`Partial<T[keyof T]>`): 用于与对象的值进行匹配的部分值。
- **属性-值对** (`[keyof T, unknown]`): 一个数组,第一个元素是属性键,第二个元素是要匹配的值。
- **属性-值对** (`[keyof T[keyof T], unknown]`): 一个数组,第一个元素是属性键,第二个元素是要匹配的值。
- **属性名称** (`string`): 要检查其真值的属性名称。
### 返回

View File

@ -132,7 +132,7 @@ export function every<T extends Record<string, unknown>>(
*
* @template T
* @param {T | null | undefined} object - The object to check through.
* @param {[keyof T, unknown]} doesMatchProperty - An array where the first element is the property key and the second element is the value to match.
* @param {[keyof T[keyof T], unknown]} doesMatchProperty - An array where the first element is the property key and the second element is the value to match.
* @returns {boolean} - `true` if every item has the specified property value, or `false` if at least one item does not match.
*
* @example
@ -143,7 +143,7 @@ export function every<T extends Record<string, unknown>>(
*/
export function every<T extends Record<string, unknown>>(
object: T | null | undefined,
doesMatchProperty: [keyof T, unknown]
doesMatchProperty: [keyof T[keyof T], unknown]
): boolean;
/**

View File

@ -111,7 +111,7 @@ export function filter<T extends Record<string, unknown>>(
*
* @template T
* @param {T | null | undefined} object - The object to iterate over.
* @param {[keyof T, unknown]} doesMatchProperty - The key-value pair to match.
* @param {[keyof T[keyof T], unknown]} doesMatchProperty - The key-value pair to match.
* @returns {T[]} - Returns a new array of elements that match the given key-value pair.
*
* @example
@ -121,7 +121,7 @@ export function filter<T extends Record<string, unknown>>(
*/
export function filter<T extends Record<string, unknown>>(
object: T | null | undefined,
doesMatchProperty: [keyof T, unknown]
doesMatchProperty: [keyof T[keyof T], unknown]
): T[];
/**

View File

@ -112,7 +112,7 @@ export function find<T extends Record<string, unknown>>(
*
* @template T
* @param {T | null | undefined} object - The object to search through.
* @param {[keyof T, unknown]} doesMatchProperty - An array where the first element is the property key and the second element is the value to match.
* @param {[keyof T[keyof T], unknown]} doesMatchProperty - An array where the first element is the property key and the second element is the value to match.
* @returns {T | undefined} - The first item that has the specified property value, or `undefined` if no match is found.
*
* @example
@ -123,7 +123,7 @@ export function find<T extends Record<string, unknown>>(
*/
export function find<T extends Record<string, unknown>>(
object: T | null | undefined,
doesMatchProperty: [keyof T, unknown]
doesMatchProperty: [keyof T[keyof T], unknown]
): T | undefined;
/**