Skip to content

Commit 7ca0747

Browse files
committed
refactor: make AllExtend implementation similar to SomeExtend
1 parent a29a13c commit 7ca0747

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

source/all-extend.d.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,17 +104,17 @@ type B = AllExtend<[1?, 2?, 3?], number | undefined>;
104104
export type AllExtend<TArray extends UnknownArray, Type, Options extends AllExtendOptions = {}> =
105105
_AllExtend<CollapseRestElement<TArray>, Type, ApplyDefaultOptions<AllExtendOptions, DefaultAllExtendOptions, Options>>;
106106

107-
type _AllExtend<TArray extends UnknownArray, Type, Options extends Required<AllExtendOptions>> = IfNotAnyOrNever<TArray, If<IsAny<Type>, true,
107+
type _AllExtend<TArray extends UnknownArray, Type, Options extends Required<AllExtendOptions>> = IfNotAnyOrNever<TArray,
108108
TArray extends readonly [infer First, ...infer Rest]
109109
? IsNever<First> extends true
110-
? Or<IsNever<Type>, Not<Options['strictNever']>> extends true
111-
// If target `Type` is also `never` OR `strictNever` is disabled, recurse further.
110+
? Or<Or<IsNever<Type>, IsAny<Type>>, Not<Options['strictNever']>> extends true
111+
// If target `Type` is also `never`, or is `any`, or `strictNever` is disabled, recurse further.
112112
? _AllExtend<Rest, Type, Options>
113113
: false
114114
: First extends Type
115115
? _AllExtend<Rest, Type, Options>
116116
: false
117-
: true
118-
>, false, false>;
117+
: true,
118+
false, false>;
119119

120120
export {};

0 commit comments

Comments
 (0)