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

fix(compat): predicate should have optional parameter #880

Merged
merged 1 commit into from
Dec 8, 2024
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/ja/reference/compat/predicate/isArrayLike.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ TypeScript の型ガードとして使用できます。パラメータとして
## インターフェース

```typescript
function isArrayLike(value: unknown): value is ArrayLike<unknown>;
function isArrayLike(value?: unknown): value is ArrayLike<unknown>;
```

### パラメータ
Expand Down
2 changes: 1 addition & 1 deletion docs/ja/reference/compat/predicate/isArrayLikeObject.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ TypeScript の型ガードとして使用できます。パラメータとして
## インターフェース

```typescript
function isArrayLikeObject(value: unknown): value is ArrayLike<unknown> & object;
function isArrayLikeObject(value?: unknown): value is ArrayLike<unknown> & object;
```

### パラメータ
Expand Down
2 changes: 1 addition & 1 deletion docs/ja/reference/compat/predicate/isElement.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
## インターフェース

```typescript
function isElement(value: any): boolean;
function isElement(value?: any): boolean;
```

### パラメータ
Expand Down
2 changes: 1 addition & 1 deletion docs/ja/reference/compat/predicate/isFinite.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
## インターフェース

```typescript
function isFinite(value: unknown): value is number;
function isFinite(value?: unknown): value is number;
```

### パラメータ
Expand Down
2 changes: 1 addition & 1 deletion docs/ja/reference/compat/predicate/isNaN.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
## インターフェース

```typescript
function isNaN(value: unknown): value is typeof NaN;
function isNaN(value?: unknown): value is typeof NaN;
```

### パラメータ
Expand Down
2 changes: 1 addition & 1 deletion docs/ja/reference/compat/predicate/isObject.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
## インターフェース

```typescript
function isObject(value: unknown): value is object;
function isObject(value?: unknown): value is object;
```

### パラメータ
Expand Down
4 changes: 2 additions & 2 deletions docs/ja/reference/compat/predicate/isObjectLike.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ TypeScript の型ガードとして使用できます。パラメータとして
## インターフェース

```typescript
export function isObjectLike(value: unknown): value is object;
export function isObjectLike(value?: unknown): value is object;
```

### パラメータ

- `value` (`T`): オブジェクトのようであるかを確認する値です。
- `value` (`unknown`): オブジェクトのようであるかを確認する値です。

### 戻り値

Expand Down
2 changes: 1 addition & 1 deletion docs/ko/reference/compat/predicate/isArrayLike.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ TypeScript의 타입 가드로 사용할 수 있어요. 파라미터로 주어
## 인터페이스

```typescript
function isArrayLike(value: unknown): value is ArrayLike<unknown>;
function isArrayLike(value?: unknown): value is ArrayLike<unknown>;
```

### 파라미터
Expand Down
2 changes: 1 addition & 1 deletion docs/ko/reference/compat/predicate/isArrayLikeObject.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ TypeScript의 타입 가드로 사용할 수 있어요. 파라미터로 주어
## 인터페이스

```typescript
function isArrayLikeObject(value: unknown): value is ArrayLike<unknown> & object;
function isArrayLikeObject(value?: unknown): value is ArrayLike<unknown> & object;
```

### 파라미터
Expand Down
2 changes: 1 addition & 1 deletion docs/ko/reference/compat/predicate/isElement.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
## 인터페이스

```typescript
function isElement(value: any): boolean;
function isElement(value?: any): boolean;
```

### 파라미터
Expand Down
2 changes: 1 addition & 1 deletion docs/ko/reference/compat/predicate/isFinite.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ TypeScript의 타입 가드로 사용할 수 있어요. 파라미터로 주어
## 인터페이스

```typescript
function isFinite(value: unknown): value is number;
function isFinite(value?: unknown): value is number;
```

### 파라미터
Expand Down
2 changes: 1 addition & 1 deletion docs/ko/reference/compat/predicate/isNaN.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ TypeScript의 타입 가드로 사용할 수 있어요. 파라미터로 주어
## 인터페이스

```typescript
function isNaN(value: unknown): value is typeof NaN;
function isNaN(value?: unknown): value is typeof NaN;
```

### 파라미터
Expand Down
2 changes: 1 addition & 1 deletion docs/ko/reference/compat/predicate/isObject.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ TypeScript의 타입 가드로 사용할 수 있어요. 파라미터로 주어
## 인터페이스

```typescript
function isObject(value: unknown): value is object;
function isObject(value?: unknown): value is object;
```

### 파라미터
Expand Down
4 changes: 2 additions & 2 deletions docs/ko/reference/compat/predicate/isObjectLike.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ TypeScript의 타입 가드로 사용할 수 있어요. 파라미터로 주어
## 인터페이스

```typescript
export function isObjectLike(value: unknown): value is object;
export function isObjectLike(value?: unknown): value is object;
```

### 파라미터

- `value` (`T`): 객체 같은지 확인할 값이에요.
- `value` (`unknown`): 객체 같은지 확인할 값이에요.

### 반환 값

Expand Down
2 changes: 1 addition & 1 deletion docs/reference/compat/predicate/isArrayLike.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ This function can also serve as a type predicate in TypeScript, narrowing the ty
## Signature

```typescript
function isArrayLike(value: unknown): value is ArrayLike<unknown>;
function isArrayLike(value?: unknown): value is ArrayLike<unknown>;
```

### Parameters
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/compat/predicate/isArrayLikeObject.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ This function can also serve as a type predicate in TypeScript, narrowing the ty
## Signature

```typescript
function isArrayLikeObject(value: unknown): value is ArrayLike<unknown> & object;
function isArrayLikeObject(value?: unknown): value is ArrayLike<unknown> & object;
```

### Parameters
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/compat/predicate/isElement.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Checks if `value` is likely a DOM element.
## Signature

```typescript
function isElement(value: any): boolean;
function isElement(value?: any): boolean;
```

### Parameters
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/compat/predicate/isFinite.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ This function can also serve as a type predicate in TypeScript, narrowing the ty
## Signature

```typescript
function isFinite(value: unknown): value is number;
function isFinite(value?: unknown): value is number;
```

### Parameters
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/compat/predicate/isNaN.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ This function can also serve as a type predicate in TypeScript, narrowing the ty
## Signature

```typescript
function isNaN(value: unknown): value is typeof NaN;
function isNaN(value?: unknown): value is typeof NaN;
```

### Parameters
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/compat/predicate/isObject.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ This function can also serve as a type predicate in TypeScript, narrowing the ty
## Signature

```typescript
function isObject(value: unknown): value is object;
function isObject(value?: unknown): value is object;
```

### Parameters
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/compat/predicate/isObjectLike.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ This function can also serve as a type predicate in TypeScript, narrowing the ty
## Signature

```typescript
function isObjectLike(value: unknown): value is object;
function isObjectLike(value?: unknown): value is object;
```

### Parameters
Expand Down
2 changes: 1 addition & 1 deletion docs/zh_hans/reference/compat/predicate/isArrayLike.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
## 签名

```typescript
function isArrayLike(value: unknown): value is ArrayLike<unknown>;
function isArrayLike(value?: unknown): value is ArrayLike<unknown>;
```

### 参数
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
## 签名

```typescript
function isArrayLikeObject(value: unknown): value is ArrayLike<unknown> & object;
function isArrayLikeObject(value?: unknown): value is ArrayLike<unknown> & object;
```

### 参数
Expand Down
2 changes: 1 addition & 1 deletion docs/zh_hans/reference/compat/predicate/isElement.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
## 签名

```typescript
function isElement(value: any): boolean;
function isElement(value?: any): boolean;
```

### 参数
Expand Down
2 changes: 1 addition & 1 deletion docs/zh_hans/reference/compat/predicate/isFinite.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
## 签名

```typescript
function isFinite(value: unknown): value is number;
function isFinite(value?: unknown): value is number;
```

### 参数
Expand Down
2 changes: 1 addition & 1 deletion docs/zh_hans/reference/compat/predicate/isNaN.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
## 签名

```typescript
function isNaN(value: unknown): value is typeof NaN;
function isNaN(value?: unknown): value is typeof NaN;
```

### 参数
Expand Down
2 changes: 1 addition & 1 deletion docs/zh_hans/reference/compat/predicate/isObject.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
## 签名

```typescript
function isObject(value: unknown): value is object;
function isObject(value?: unknown): value is object;
```

### 参数
Expand Down
2 changes: 1 addition & 1 deletion docs/zh_hans/reference/compat/predicate/isObjectLike.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
## 签名

```typescript
function isObjectLike(value: unknown): value is object;
function isObjectLike(value?: unknown): value is object;
```

### 参数
Expand Down
2 changes: 1 addition & 1 deletion src/compat/predicate/isArrayLike.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ import { isLength } from '../../predicate/isLength.ts';
* isArrayLike(null); // false
* isArrayLike(undefined); // false
*/
export function isArrayLike(value: unknown): value is ArrayLike<unknown> {
export function isArrayLike(value?: unknown): value is ArrayLike<unknown> {
return value != null && typeof value !== 'function' && isLength((value as ArrayLike<unknown>).length);
}
2 changes: 1 addition & 1 deletion src/compat/predicate/isArrayLikeObject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ import { isObjectLike } from './isObjectLike.ts';
* isArrayLikeObject('abc'); // false
* isArrayLikeObject(()=>{}); // false
*/
export function isArrayLikeObject(value: unknown): value is ArrayLike<unknown> & object {
export function isArrayLikeObject(value?: unknown): value is ArrayLike<unknown> & object {
return isObjectLike(value) && isArrayLike(value);
}
2 changes: 1 addition & 1 deletion src/compat/predicate/isElement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ import { isPlainObject } from './isPlainObject';
* console.log(isElement(document.body)); // true
* console.log(isElement('<body>')); // false
*/
export function isElement(value: any): boolean {
export function isElement(value?: any): boolean {
return isObjectLike(value) && (value as any).nodeType === 1 && !isPlainObject(value);
}
2 changes: 1 addition & 1 deletion src/compat/predicate/isFinite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@
* console.log(isFinite(value3)); // false
* ```
*/
export function isFinite(value: unknown): value is number {
export function isFinite(value?: unknown): value is number {
return Number.isFinite(value);
}
2 changes: 1 addition & 1 deletion src/compat/predicate/isNaN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
* isNaN('NaN'); // false
* isNaN(undefined); // false
*/
export function isNaN(value: unknown): value is typeof NaN {
export function isNaN(value?: unknown): value is typeof NaN {
return Number.isNaN(value);
}
2 changes: 1 addition & 1 deletion src/compat/predicate/isObject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@
* console.log(isObject(value4)); // false
*/

export function isObject(value: unknown): value is object {
export function isObject(value?: unknown): value is object {
return value !== null && (typeof value === 'object' || typeof value === 'function');
}
2 changes: 1 addition & 1 deletion src/compat/predicate/isObjectLike.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@
* console.log(isObjectLike(value5)); // false
*/

export function isObjectLike(value: unknown): value is object {
export function isObjectLike(value?: unknown): value is object {
return typeof value === 'object' && value !== null;
}
Loading