Skip to content

Commit d4fb6ae

Browse files
authored
improve: added types for Filter
1 parent 691b9a1 commit d4fb6ae

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

source/internal/array.d.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import type {If} from '../if.d.ts';
2-
import type {IsAny} from '../is-any.d.ts';
32
import type {IsNever} from '../is-never.d.ts';
4-
import type {IsUnion} from '../is-union.d.ts';
53
import type {EmptyObject} from '../empty-object.d.ts';
64
import type {UnknownArray} from '../unknown-array.d.ts';
75
import type {OptionalKeysOf} from '../optional-keys-of.d.ts';
@@ -109,14 +107,19 @@ Returns a `boolean` for whether the type is an empty array, the `[]` or `readonl
109107
@example
110108
```
111109
import type {IsEmptyArray} from 'type-fest';
110+
112111
type Pass1 = IsEmptyArray<[]>;
113112
//=> true
113+
114114
type Pass2 = IsEmptyArray<readonly []>;
115115
//=> true
116+
116117
type Fail1 = IsEmptyArray<[0]>;
117118
//=> false
119+
118120
type Fail2 = IsEmptyArray<[0?]>;
119121
//=> false
122+
120123
type Fail3 = IsEmptyArray<...string[]>;
121124
//=> false
122125
```

source/internal/type.d.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,17 +122,18 @@ export type Extends<T, U, S extends boolean = false> = {
122122
/**
123123
Performs a loose type comparison: checks if wheither of the members in `T` extends `U`.
124124
125-
This is useful when needing to know if `T extends U` without distributing `T` in Main type
125+
This is useful when needing to know if any member of `T` extends `U` without returning `boolean`.
126126
*/
127127
export type ExtendsLoose<T, U> = IsNotFalse<T extends U ? true : false>;
128+
// ? Should this get exposed publicly
128129

129130
/**
130131
A union of `falsy` types in JS.
131132
*/
132-
export type Falsy = false | 0 | '' | null | undefined; // `| never`
133+
export type Falsy = 0 | 0n | '' | false | null | undefined; // `| never`
133134

134135
/**
135-
Checks if `T` is {@link Falsy `falsy`} similar to `Boolean(T)`.
136+
Checks if `T` is **not** {@link Falsy `falsy`} similar to `Boolean(T)`.
136137
*/
137138
export type IsTruthy<T> =
138139
IsNever<T> extends true ? false

0 commit comments

Comments
 (0)