oxlint-tailwindcss 1.3.5 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -17
- package/dist/index.cjs +2498 -786
- package/dist/index.d.cts +41 -64
- package/dist/index.d.mts +41 -64
- package/dist/index.mjs +2499 -787
- package/package.json +7 -8
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//#region ../../node_modules/.pnpm/@oxlint+plugins@1.
|
|
1
|
+
//#region ../../node_modules/.pnpm/@oxlint+plugins@1.74.0/node_modules/@oxlint/plugins/index.d.ts
|
|
2
2
|
//#endregion
|
|
3
3
|
//#region src-js/plugins/tokens.d.ts
|
|
4
4
|
/**
|
|
@@ -2428,7 +2428,7 @@ type Options = JsonValue[];
|
|
|
2428
2428
|
*/
|
|
2429
2429
|
type RuleOptionsSchema = JSONSchema4 | JSONSchema4[] | false;
|
|
2430
2430
|
//#endregion
|
|
2431
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
2431
|
+
//#region ../../node_modules/.pnpm/type-fest@5.8.0/node_modules/type-fest/source/is-any.d.ts
|
|
2432
2432
|
/**
|
|
2433
2433
|
Returns a boolean for whether the given type is `any`.
|
|
2434
2434
|
|
|
@@ -2459,7 +2459,7 @@ const anyA = get(anyObject, 'a');
|
|
|
2459
2459
|
*/
|
|
2460
2460
|
type IsAny<T> = 0 extends 1 & NoInfer<T> ? true : false;
|
|
2461
2461
|
//#endregion
|
|
2462
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
2462
|
+
//#region ../../node_modules/.pnpm/type-fest@5.8.0/node_modules/type-fest/source/is-optional-key-of.d.ts
|
|
2463
2463
|
/**
|
|
2464
2464
|
Returns a boolean for whether the given key is an optional key of type.
|
|
2465
2465
|
|
|
@@ -2502,7 +2502,7 @@ type T5 = IsOptionalKeyOf<User | Admin, 'surname'>;
|
|
|
2502
2502
|
*/
|
|
2503
2503
|
type IsOptionalKeyOf<Type extends object, Key extends keyof Type> = IsAny<Type | Key> extends true ? never : Key extends keyof Type ? Type extends Record<Key, Type[Key]> ? false : true : false;
|
|
2504
2504
|
//#endregion
|
|
2505
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
2505
|
+
//#region ../../node_modules/.pnpm/type-fest@5.8.0/node_modules/type-fest/source/optional-keys-of.d.ts
|
|
2506
2506
|
/**
|
|
2507
2507
|
Extract all optional keys from the given type.
|
|
2508
2508
|
|
|
@@ -2538,9 +2538,9 @@ const update2: UpdateOperation<User> = {
|
|
|
2538
2538
|
*/
|
|
2539
2539
|
type OptionalKeysOf<Type extends object> = Type extends unknown // For distributing `Type`
|
|
2540
2540
|
? (keyof { [Key in keyof Type as IsOptionalKeyOf<Type, Key> extends false ? never : Key]: never; }) & keyof Type // Intersect with `keyof Type` to ensure result of `OptionalKeysOf<Type>` is always assignable to `keyof Type`
|
|
2541
|
-
: never;
|
|
2541
|
+
: never; // Should never happen
|
|
2542
2542
|
//#endregion
|
|
2543
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
2543
|
+
//#region ../../node_modules/.pnpm/type-fest@5.8.0/node_modules/type-fest/source/required-keys-of.d.ts
|
|
2544
2544
|
/**
|
|
2545
2545
|
Extract all required keys from the given type.
|
|
2546
2546
|
|
|
@@ -2572,9 +2572,9 @@ const validator3 = createValidation<User>('luckyNumber', value => value > 0);
|
|
|
2572
2572
|
@category Utilities
|
|
2573
2573
|
*/
|
|
2574
2574
|
type RequiredKeysOf<Type extends object> = Type extends unknown // For distributing `Type`
|
|
2575
|
-
? Exclude<keyof Type, OptionalKeysOf<Type>> : never;
|
|
2575
|
+
? Exclude<keyof Type, OptionalKeysOf<Type>> : never; // Should never happen
|
|
2576
2576
|
//#endregion
|
|
2577
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
2577
|
+
//#region ../../node_modules/.pnpm/type-fest@5.8.0/node_modules/type-fest/source/is-never.d.ts
|
|
2578
2578
|
/**
|
|
2579
2579
|
Returns a boolean for whether the given type is `never`.
|
|
2580
2580
|
|
|
@@ -2630,7 +2630,7 @@ type B = IsTrueFixed<never>;
|
|
|
2630
2630
|
*/
|
|
2631
2631
|
type IsNever<T> = [T] extends [never] ? true : false;
|
|
2632
2632
|
//#endregion
|
|
2633
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
2633
|
+
//#region ../../node_modules/.pnpm/type-fest@5.8.0/node_modules/type-fest/source/if.d.ts
|
|
2634
2634
|
/**
|
|
2635
2635
|
An if-else-like type that resolves depending on whether the given `boolean` type is `true` or `false`.
|
|
2636
2636
|
|
|
@@ -2725,22 +2725,22 @@ type Works = IncludesWithoutIf<HundredZeroes, '1'>;
|
|
|
2725
2725
|
*/
|
|
2726
2726
|
type If<Type extends boolean, IfBranch, ElseBranch> = IsNever<Type> extends true ? ElseBranch : Type extends true ? IfBranch : ElseBranch;
|
|
2727
2727
|
//#endregion
|
|
2728
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
2728
|
+
//#region ../../node_modules/.pnpm/type-fest@5.8.0/node_modules/type-fest/source/internal/type.d.ts
|
|
2729
2729
|
/**
|
|
2730
2730
|
An if-else-like type that resolves depending on whether the given type is `any` or `never`.
|
|
2731
2731
|
|
|
2732
2732
|
@example
|
|
2733
2733
|
```
|
|
2734
|
-
// When `T` is
|
|
2735
|
-
type A = IfNotAnyOrNever<string, 'VALID'
|
|
2734
|
+
// When `T` is neither `any` nor `never` (like `string`) => Returns `IfNot` branch
|
|
2735
|
+
type A = IfNotAnyOrNever<string, {ifNot: 'VALID'; ifAny: 'IS_ANY'; ifNever: 'IS_NEVER'}>;
|
|
2736
2736
|
//=> 'VALID'
|
|
2737
2737
|
|
|
2738
2738
|
// When `T` is `any` => Returns `IfAny` branch
|
|
2739
|
-
type B = IfNotAnyOrNever<any, 'VALID'
|
|
2739
|
+
type B = IfNotAnyOrNever<any, {ifNot: 'VALID'; ifAny: 'IS_ANY'; ifNever: 'IS_NEVER'}>;
|
|
2740
2740
|
//=> 'IS_ANY'
|
|
2741
2741
|
|
|
2742
2742
|
// When `T` is `never` => Returns `IfNever` branch
|
|
2743
|
-
type C = IfNotAnyOrNever<never, 'VALID'
|
|
2743
|
+
type C = IfNotAnyOrNever<never, {ifNot: 'VALID'; ifAny: 'IS_ANY'; ifNever: 'IS_NEVER'}>;
|
|
2744
2744
|
//=> 'IS_NEVER'
|
|
2745
2745
|
```
|
|
2746
2746
|
|
|
@@ -2753,7 +2753,7 @@ import type {StringRepeat} from 'type-fest';
|
|
|
2753
2753
|
type NineHundredNinetyNineSpaces = StringRepeat<' ', 999>;
|
|
2754
2754
|
|
|
2755
2755
|
// The following implementation is not tail recursive
|
|
2756
|
-
type TrimLeft<S extends string> = IfNotAnyOrNever<S, S extends ` ${infer R}` ? TrimLeft<R> : S>;
|
|
2756
|
+
type TrimLeft<S extends string> = IfNotAnyOrNever<S, {ifNot: S extends ` ${infer R}` ? TrimLeft<R> : S}>;
|
|
2757
2757
|
|
|
2758
2758
|
// Hence, instantiations with long strings will fail
|
|
2759
2759
|
// @ts-expect-error
|
|
@@ -2762,7 +2762,7 @@ type T1 = TrimLeft<NineHundredNinetyNineSpaces>;
|
|
|
2762
2762
|
// Error: Type instantiation is excessively deep and possibly infinite.
|
|
2763
2763
|
|
|
2764
2764
|
// To fix this, move the recursion into a helper type
|
|
2765
|
-
type TrimLeftOptimised<S extends string> = IfNotAnyOrNever<S, _TrimLeftOptimised<S
|
|
2765
|
+
type TrimLeftOptimised<S extends string> = IfNotAnyOrNever<S, {ifNot: _TrimLeftOptimised<S>}>;
|
|
2766
2766
|
|
|
2767
2767
|
type _TrimLeftOptimised<S extends string> = S extends ` ${infer R}` ? _TrimLeftOptimised<R> : S;
|
|
2768
2768
|
|
|
@@ -2770,9 +2770,13 @@ type T2 = TrimLeftOptimised<NineHundredNinetyNineSpaces>;
|
|
|
2770
2770
|
//=> ''
|
|
2771
2771
|
```
|
|
2772
2772
|
*/
|
|
2773
|
-
type IfNotAnyOrNever<T,
|
|
2773
|
+
type IfNotAnyOrNever<T, Cases extends {
|
|
2774
|
+
ifNot: unknown;
|
|
2775
|
+
ifAny?: unknown;
|
|
2776
|
+
ifNever?: unknown;
|
|
2777
|
+
}> = IsAny<T> extends true ? 'ifAny' extends keyof Cases ? Cases['ifAny'] : any : IsNever<T> extends true ? 'ifNever' extends keyof Cases ? Cases['ifNever'] : never : Cases['ifNot'];
|
|
2774
2778
|
//#endregion
|
|
2775
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
2779
|
+
//#region ../../node_modules/.pnpm/type-fest@5.8.0/node_modules/type-fest/source/simplify.d.ts
|
|
2776
2780
|
/**
|
|
2777
2781
|
Useful to flatten the type output to improve type hints shown in editors. And also to transform an interface into a type to aide with assignability.
|
|
2778
2782
|
|
|
@@ -2833,7 +2837,7 @@ fn(someInterface as Simplify<SomeInterface>); // Good: transform an `interface`
|
|
|
2833
2837
|
*/
|
|
2834
2838
|
type Simplify<T> = { [KeyType in keyof T]: T[KeyType]; } & {};
|
|
2835
2839
|
//#endregion
|
|
2836
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
2840
|
+
//#region ../../node_modules/.pnpm/type-fest@5.8.0/node_modules/type-fest/source/is-equal.d.ts
|
|
2837
2841
|
/**
|
|
2838
2842
|
Returns a boolean for whether the two given types are equal.
|
|
2839
2843
|
|
|
@@ -2864,7 +2868,7 @@ type IsEqual<A, B> = [A] extends [B] ? [B] extends [A] ? _IsEqual<A, B> : false
|
|
|
2864
2868
|
// This version fails the `equalWrappedTupleIntersectionToBeNeverAndNeverExpanded` test in `test-d/is-equal.ts`.
|
|
2865
2869
|
type _IsEqual<A, B> = (<G>() => G extends A & G | G ? 1 : 2) extends (<G>() => G extends B & G | G ? 1 : 2) ? true : false;
|
|
2866
2870
|
//#endregion
|
|
2867
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
2871
|
+
//#region ../../node_modules/.pnpm/type-fest@5.8.0/node_modules/type-fest/source/omit-index-signature.d.ts
|
|
2868
2872
|
/**
|
|
2869
2873
|
Omit any index signatures from the given object type, leaving only explicitly defined properties.
|
|
2870
2874
|
|
|
@@ -2958,7 +2962,7 @@ type ExampleWithoutIndexSignatures = OmitIndexSignature<Example>;
|
|
|
2958
2962
|
*/
|
|
2959
2963
|
type OmitIndexSignature<ObjectType> = { [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? never : KeyType]: ObjectType[KeyType]; };
|
|
2960
2964
|
//#endregion
|
|
2961
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
2965
|
+
//#region ../../node_modules/.pnpm/type-fest@5.8.0/node_modules/type-fest/source/pick-index-signature.d.ts
|
|
2962
2966
|
/**
|
|
2963
2967
|
Pick only index signatures from the given object type, leaving out all explicitly defined properties.
|
|
2964
2968
|
|
|
@@ -3006,7 +3010,7 @@ type ExampleIndexSignature = PickIndexSignature<Example>;
|
|
|
3006
3010
|
*/
|
|
3007
3011
|
type PickIndexSignature<ObjectType> = { [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? KeyType : never]: ObjectType[KeyType]; };
|
|
3008
3012
|
//#endregion
|
|
3009
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
3013
|
+
//#region ../../node_modules/.pnpm/type-fest@5.8.0/node_modules/type-fest/source/merge.d.ts
|
|
3010
3014
|
// Merges two objects without worrying about index signatures.
|
|
3011
3015
|
type SimpleMerge<Destination, Source> = Simplify<{ [Key in keyof Destination as Key extends keyof Source ? never : Key]: Destination[Key]; } & Source>;
|
|
3012
3016
|
/**
|
|
@@ -3074,11 +3078,10 @@ Note: If you want a merge type that more accurately reflects the runtime behavio
|
|
|
3074
3078
|
type Merge<Destination, Source> = Destination extends unknown // For distributing `Destination`
|
|
3075
3079
|
? Source extends unknown // For distributing `Source`
|
|
3076
3080
|
? If<IsEqual<Destination, Source>, Destination, _Merge<Destination, Source>> : never // Should never happen
|
|
3077
|
-
: never;
|
|
3078
|
-
// Should never happen
|
|
3081
|
+
: never; // Should never happen
|
|
3079
3082
|
type _Merge<Destination, Source> = Simplify<SimpleMerge<PickIndexSignature<Destination>, PickIndexSignature<Source>> & SimpleMerge<OmitIndexSignature<Destination>, OmitIndexSignature<Source>>>;
|
|
3080
3083
|
//#endregion
|
|
3081
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
3084
|
+
//#region ../../node_modules/.pnpm/type-fest@5.8.0/node_modules/type-fest/source/internal/object.d.ts
|
|
3082
3085
|
/**
|
|
3083
3086
|
Merges user specified options with default options.
|
|
3084
3087
|
|
|
@@ -3134,35 +3137,8 @@ type Result = ApplyDefaultOptions<PathsOptions, DefaultPathsOptions, SpecifiedOp
|
|
|
3134
3137
|
type ApplyDefaultOptions<Options extends object, Defaults extends Simplify<Omit<Required<Options>, RequiredKeysOf<Options>> & Partial<Record<RequiredKeysOf<Options>, never>>>, SpecifiedOptions extends Options> = _ApplyDefaultOptions<Options, Defaults, SpecifiedOptions> extends (infer Result extends Required<Options> // `extends Required<Options>` ensures that `ApplyDefaultOptions<SomeOption, ...>` is always assignable to `Required<SomeOption>`
|
|
3135
3138
|
) ? Result : never;
|
|
3136
3139
|
type _ApplyDefaultOptions<Options, Defaults, SpecifiedOptions> = If<IsAny<SpecifiedOptions>, Defaults, If<IsNever<SpecifiedOptions>, Defaults, Merge<Defaults, { [Key in keyof SpecifiedOptions as undefined extends Required<Options>[Key & keyof Options] ? Key : undefined extends SpecifiedOptions[Key] ? never : Key]: SpecifiedOptions[Key]; }>>>;
|
|
3137
|
-
/**
|
|
3138
|
-
Collapses literal types in a union into their corresponding primitive types, when possible. For example, `CollapseLiterals<'foo' | 'bar' | (string & {})>` returns `string`.
|
|
3139
|
-
|
|
3140
|
-
Note: This doesn't collapse literals within tagged types. For example, `CollapseLiterals<Tagged<'foo' | (string & {}), 'Tag'>>` returns `("foo" & Tag<"Tag", never>) | (string & Tag<"Tag", never>)` and not `string & Tag<"Tag", never>`.
|
|
3141
|
-
|
|
3142
|
-
Use-case: For collapsing unions created using {@link LiteralUnion}.
|
|
3143
|
-
|
|
3144
|
-
@example
|
|
3145
|
-
```
|
|
3146
|
-
import type {LiteralUnion} from 'type-fest';
|
|
3147
|
-
|
|
3148
|
-
type A = CollapseLiterals<'foo' | 'bar' | (string & {})>;
|
|
3149
|
-
//=> string
|
|
3150
|
-
|
|
3151
|
-
type B = CollapseLiterals<LiteralUnion<1 | 2 | 3, number>>;
|
|
3152
|
-
//=> number
|
|
3153
|
-
|
|
3154
|
-
type C = CollapseLiterals<LiteralUnion<'onClick' | 'onChange', `on${string}`>>;
|
|
3155
|
-
//=> `on${string}`
|
|
3156
|
-
|
|
3157
|
-
type D = CollapseLiterals<'click' | 'change' | (`on${string}` & {})>;
|
|
3158
|
-
//=> 'click' | 'change' | `on${string}`
|
|
3159
|
-
|
|
3160
|
-
type E = CollapseLiterals<LiteralUnion<'foo' | 'bar', string> | null | undefined>;
|
|
3161
|
-
//=> string | null | undefined
|
|
3162
|
-
```
|
|
3163
|
-
*/
|
|
3164
3140
|
//#endregion
|
|
3165
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
3141
|
+
//#region ../../node_modules/.pnpm/type-fest@5.8.0/node_modules/type-fest/source/except.d.ts
|
|
3166
3142
|
/**
|
|
3167
3143
|
Filter out keys from an object.
|
|
3168
3144
|
|
|
@@ -3193,10 +3169,12 @@ type Filtered = Filter<'bar', 'foo'>;
|
|
|
3193
3169
|
type Filter<KeyType, ExcludeType> = IsEqual<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
|
|
3194
3170
|
type ExceptOptions = {
|
|
3195
3171
|
/**
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
|
|
3172
|
+
Disallow assigning non-specified properties.
|
|
3173
|
+
|
|
3174
|
+
Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`.
|
|
3175
|
+
|
|
3176
|
+
@default false
|
|
3177
|
+
*/
|
|
3200
3178
|
requireExactProps?: boolean;
|
|
3201
3179
|
};
|
|
3202
3180
|
type DefaultExceptOptions = {
|
|
@@ -3260,7 +3238,7 @@ type PostPayloadFixed = Except<UserData, 'email'>;
|
|
|
3260
3238
|
type Except<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions = {}> = _Except<ObjectType, KeysType, ApplyDefaultOptions<ExceptOptions, DefaultExceptOptions, Options>>;
|
|
3261
3239
|
type _Except<ObjectType, KeysType extends keyof ObjectType, Options extends Required<ExceptOptions>> = { [KeyType in keyof ObjectType as Filter<KeyType, KeysType>]: ObjectType[KeyType]; } & (Options['requireExactProps'] extends true ? Partial<Record<KeysType, never>> : {});
|
|
3262
3240
|
//#endregion
|
|
3263
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
3241
|
+
//#region ../../node_modules/.pnpm/type-fest@5.8.0/node_modules/type-fest/source/require-at-least-one.d.ts
|
|
3264
3242
|
/**
|
|
3265
3243
|
Create a type that requires at least one of the given keys, while keeping the remaining keys as is.
|
|
3266
3244
|
|
|
@@ -3282,12 +3260,14 @@ const responder: RequireAtLeastOne<Responder, 'text' | 'json'> = {
|
|
|
3282
3260
|
|
|
3283
3261
|
@category Object
|
|
3284
3262
|
*/
|
|
3285
|
-
type RequireAtLeastOne<ObjectType, KeysType extends keyof ObjectType = keyof ObjectType> = IfNotAnyOrNever<ObjectType,
|
|
3263
|
+
type RequireAtLeastOne<ObjectType, KeysType extends keyof ObjectType = keyof ObjectType> = IfNotAnyOrNever<ObjectType, {
|
|
3264
|
+
ifNot: If<IsNever<KeysType>, never, _RequireAtLeastOne<ObjectType, If<IsAny<KeysType>, keyof ObjectType, KeysType>>>;
|
|
3265
|
+
}>;
|
|
3286
3266
|
type _RequireAtLeastOne<ObjectType, KeysType extends keyof ObjectType> = { [
|
|
3287
3267
|
// For each `Key` in `KeysType` make a mapped type:
|
|
3288
|
-
// 2. Make all other keys in `KeysType` optional
|
|
3289
3268
|
Key in KeysType]-?: Required<Pick<ObjectType, Key>> // 1. Make `Key`'s type required
|
|
3290
|
-
& Partial<Pick<ObjectType, Exclude<KeysType, Key
|
|
3269
|
+
& Partial<Pick<ObjectType, Exclude<KeysType, Key>>> // 2. Make all other keys in `KeysType` optional
|
|
3270
|
+
; }[KeysType] & Except<ObjectType, KeysType>; // 3. Add the remaining keys not in `KeysType`
|
|
3291
3271
|
//#endregion
|
|
3292
3272
|
//#region src-js/plugins/fix.d.ts
|
|
3293
3273
|
type FixFn = (fixer: Fixer) => Fix | Array<Fix | null | undefined> | IterableIterator<Fix | null | undefined> | null | undefined;
|
|
@@ -3355,9 +3335,6 @@ interface SuggestionBase {
|
|
|
3355
3335
|
data?: DiagnosticData | null | undefined;
|
|
3356
3336
|
fix: FixFn;
|
|
3357
3337
|
}
|
|
3358
|
-
/**
|
|
3359
|
-
* Suggested fix in form sent to Rust.
|
|
3360
|
-
*/
|
|
3361
3338
|
//#endregion
|
|
3362
3339
|
//#region src-js/plugins/source_code.d.ts
|
|
3363
3340
|
declare const SOURCE_CODE: Readonly<{
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//#region ../../node_modules/.pnpm/@oxlint+plugins@1.
|
|
1
|
+
//#region ../../node_modules/.pnpm/@oxlint+plugins@1.74.0/node_modules/@oxlint/plugins/index.d.ts
|
|
2
2
|
//#endregion
|
|
3
3
|
//#region src-js/plugins/tokens.d.ts
|
|
4
4
|
/**
|
|
@@ -2428,7 +2428,7 @@ type Options = JsonValue[];
|
|
|
2428
2428
|
*/
|
|
2429
2429
|
type RuleOptionsSchema = JSONSchema4 | JSONSchema4[] | false;
|
|
2430
2430
|
//#endregion
|
|
2431
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
2431
|
+
//#region ../../node_modules/.pnpm/type-fest@5.8.0/node_modules/type-fest/source/is-any.d.ts
|
|
2432
2432
|
/**
|
|
2433
2433
|
Returns a boolean for whether the given type is `any`.
|
|
2434
2434
|
|
|
@@ -2459,7 +2459,7 @@ const anyA = get(anyObject, 'a');
|
|
|
2459
2459
|
*/
|
|
2460
2460
|
type IsAny<T> = 0 extends 1 & NoInfer<T> ? true : false;
|
|
2461
2461
|
//#endregion
|
|
2462
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
2462
|
+
//#region ../../node_modules/.pnpm/type-fest@5.8.0/node_modules/type-fest/source/is-optional-key-of.d.ts
|
|
2463
2463
|
/**
|
|
2464
2464
|
Returns a boolean for whether the given key is an optional key of type.
|
|
2465
2465
|
|
|
@@ -2502,7 +2502,7 @@ type T5 = IsOptionalKeyOf<User | Admin, 'surname'>;
|
|
|
2502
2502
|
*/
|
|
2503
2503
|
type IsOptionalKeyOf<Type extends object, Key extends keyof Type> = IsAny<Type | Key> extends true ? never : Key extends keyof Type ? Type extends Record<Key, Type[Key]> ? false : true : false;
|
|
2504
2504
|
//#endregion
|
|
2505
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
2505
|
+
//#region ../../node_modules/.pnpm/type-fest@5.8.0/node_modules/type-fest/source/optional-keys-of.d.ts
|
|
2506
2506
|
/**
|
|
2507
2507
|
Extract all optional keys from the given type.
|
|
2508
2508
|
|
|
@@ -2538,9 +2538,9 @@ const update2: UpdateOperation<User> = {
|
|
|
2538
2538
|
*/
|
|
2539
2539
|
type OptionalKeysOf<Type extends object> = Type extends unknown // For distributing `Type`
|
|
2540
2540
|
? (keyof { [Key in keyof Type as IsOptionalKeyOf<Type, Key> extends false ? never : Key]: never; }) & keyof Type // Intersect with `keyof Type` to ensure result of `OptionalKeysOf<Type>` is always assignable to `keyof Type`
|
|
2541
|
-
: never;
|
|
2541
|
+
: never; // Should never happen
|
|
2542
2542
|
//#endregion
|
|
2543
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
2543
|
+
//#region ../../node_modules/.pnpm/type-fest@5.8.0/node_modules/type-fest/source/required-keys-of.d.ts
|
|
2544
2544
|
/**
|
|
2545
2545
|
Extract all required keys from the given type.
|
|
2546
2546
|
|
|
@@ -2572,9 +2572,9 @@ const validator3 = createValidation<User>('luckyNumber', value => value > 0);
|
|
|
2572
2572
|
@category Utilities
|
|
2573
2573
|
*/
|
|
2574
2574
|
type RequiredKeysOf<Type extends object> = Type extends unknown // For distributing `Type`
|
|
2575
|
-
? Exclude<keyof Type, OptionalKeysOf<Type>> : never;
|
|
2575
|
+
? Exclude<keyof Type, OptionalKeysOf<Type>> : never; // Should never happen
|
|
2576
2576
|
//#endregion
|
|
2577
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
2577
|
+
//#region ../../node_modules/.pnpm/type-fest@5.8.0/node_modules/type-fest/source/is-never.d.ts
|
|
2578
2578
|
/**
|
|
2579
2579
|
Returns a boolean for whether the given type is `never`.
|
|
2580
2580
|
|
|
@@ -2630,7 +2630,7 @@ type B = IsTrueFixed<never>;
|
|
|
2630
2630
|
*/
|
|
2631
2631
|
type IsNever<T> = [T] extends [never] ? true : false;
|
|
2632
2632
|
//#endregion
|
|
2633
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
2633
|
+
//#region ../../node_modules/.pnpm/type-fest@5.8.0/node_modules/type-fest/source/if.d.ts
|
|
2634
2634
|
/**
|
|
2635
2635
|
An if-else-like type that resolves depending on whether the given `boolean` type is `true` or `false`.
|
|
2636
2636
|
|
|
@@ -2725,22 +2725,22 @@ type Works = IncludesWithoutIf<HundredZeroes, '1'>;
|
|
|
2725
2725
|
*/
|
|
2726
2726
|
type If<Type extends boolean, IfBranch, ElseBranch> = IsNever<Type> extends true ? ElseBranch : Type extends true ? IfBranch : ElseBranch;
|
|
2727
2727
|
//#endregion
|
|
2728
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
2728
|
+
//#region ../../node_modules/.pnpm/type-fest@5.8.0/node_modules/type-fest/source/internal/type.d.ts
|
|
2729
2729
|
/**
|
|
2730
2730
|
An if-else-like type that resolves depending on whether the given type is `any` or `never`.
|
|
2731
2731
|
|
|
2732
2732
|
@example
|
|
2733
2733
|
```
|
|
2734
|
-
// When `T` is
|
|
2735
|
-
type A = IfNotAnyOrNever<string, 'VALID'
|
|
2734
|
+
// When `T` is neither `any` nor `never` (like `string`) => Returns `IfNot` branch
|
|
2735
|
+
type A = IfNotAnyOrNever<string, {ifNot: 'VALID'; ifAny: 'IS_ANY'; ifNever: 'IS_NEVER'}>;
|
|
2736
2736
|
//=> 'VALID'
|
|
2737
2737
|
|
|
2738
2738
|
// When `T` is `any` => Returns `IfAny` branch
|
|
2739
|
-
type B = IfNotAnyOrNever<any, 'VALID'
|
|
2739
|
+
type B = IfNotAnyOrNever<any, {ifNot: 'VALID'; ifAny: 'IS_ANY'; ifNever: 'IS_NEVER'}>;
|
|
2740
2740
|
//=> 'IS_ANY'
|
|
2741
2741
|
|
|
2742
2742
|
// When `T` is `never` => Returns `IfNever` branch
|
|
2743
|
-
type C = IfNotAnyOrNever<never, 'VALID'
|
|
2743
|
+
type C = IfNotAnyOrNever<never, {ifNot: 'VALID'; ifAny: 'IS_ANY'; ifNever: 'IS_NEVER'}>;
|
|
2744
2744
|
//=> 'IS_NEVER'
|
|
2745
2745
|
```
|
|
2746
2746
|
|
|
@@ -2753,7 +2753,7 @@ import type {StringRepeat} from 'type-fest';
|
|
|
2753
2753
|
type NineHundredNinetyNineSpaces = StringRepeat<' ', 999>;
|
|
2754
2754
|
|
|
2755
2755
|
// The following implementation is not tail recursive
|
|
2756
|
-
type TrimLeft<S extends string> = IfNotAnyOrNever<S, S extends ` ${infer R}` ? TrimLeft<R> : S>;
|
|
2756
|
+
type TrimLeft<S extends string> = IfNotAnyOrNever<S, {ifNot: S extends ` ${infer R}` ? TrimLeft<R> : S}>;
|
|
2757
2757
|
|
|
2758
2758
|
// Hence, instantiations with long strings will fail
|
|
2759
2759
|
// @ts-expect-error
|
|
@@ -2762,7 +2762,7 @@ type T1 = TrimLeft<NineHundredNinetyNineSpaces>;
|
|
|
2762
2762
|
// Error: Type instantiation is excessively deep and possibly infinite.
|
|
2763
2763
|
|
|
2764
2764
|
// To fix this, move the recursion into a helper type
|
|
2765
|
-
type TrimLeftOptimised<S extends string> = IfNotAnyOrNever<S, _TrimLeftOptimised<S
|
|
2765
|
+
type TrimLeftOptimised<S extends string> = IfNotAnyOrNever<S, {ifNot: _TrimLeftOptimised<S>}>;
|
|
2766
2766
|
|
|
2767
2767
|
type _TrimLeftOptimised<S extends string> = S extends ` ${infer R}` ? _TrimLeftOptimised<R> : S;
|
|
2768
2768
|
|
|
@@ -2770,9 +2770,13 @@ type T2 = TrimLeftOptimised<NineHundredNinetyNineSpaces>;
|
|
|
2770
2770
|
//=> ''
|
|
2771
2771
|
```
|
|
2772
2772
|
*/
|
|
2773
|
-
type IfNotAnyOrNever<T,
|
|
2773
|
+
type IfNotAnyOrNever<T, Cases extends {
|
|
2774
|
+
ifNot: unknown;
|
|
2775
|
+
ifAny?: unknown;
|
|
2776
|
+
ifNever?: unknown;
|
|
2777
|
+
}> = IsAny<T> extends true ? 'ifAny' extends keyof Cases ? Cases['ifAny'] : any : IsNever<T> extends true ? 'ifNever' extends keyof Cases ? Cases['ifNever'] : never : Cases['ifNot'];
|
|
2774
2778
|
//#endregion
|
|
2775
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
2779
|
+
//#region ../../node_modules/.pnpm/type-fest@5.8.0/node_modules/type-fest/source/simplify.d.ts
|
|
2776
2780
|
/**
|
|
2777
2781
|
Useful to flatten the type output to improve type hints shown in editors. And also to transform an interface into a type to aide with assignability.
|
|
2778
2782
|
|
|
@@ -2833,7 +2837,7 @@ fn(someInterface as Simplify<SomeInterface>); // Good: transform an `interface`
|
|
|
2833
2837
|
*/
|
|
2834
2838
|
type Simplify<T> = { [KeyType in keyof T]: T[KeyType]; } & {};
|
|
2835
2839
|
//#endregion
|
|
2836
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
2840
|
+
//#region ../../node_modules/.pnpm/type-fest@5.8.0/node_modules/type-fest/source/is-equal.d.ts
|
|
2837
2841
|
/**
|
|
2838
2842
|
Returns a boolean for whether the two given types are equal.
|
|
2839
2843
|
|
|
@@ -2864,7 +2868,7 @@ type IsEqual<A, B> = [A] extends [B] ? [B] extends [A] ? _IsEqual<A, B> : false
|
|
|
2864
2868
|
// This version fails the `equalWrappedTupleIntersectionToBeNeverAndNeverExpanded` test in `test-d/is-equal.ts`.
|
|
2865
2869
|
type _IsEqual<A, B> = (<G>() => G extends A & G | G ? 1 : 2) extends (<G>() => G extends B & G | G ? 1 : 2) ? true : false;
|
|
2866
2870
|
//#endregion
|
|
2867
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
2871
|
+
//#region ../../node_modules/.pnpm/type-fest@5.8.0/node_modules/type-fest/source/omit-index-signature.d.ts
|
|
2868
2872
|
/**
|
|
2869
2873
|
Omit any index signatures from the given object type, leaving only explicitly defined properties.
|
|
2870
2874
|
|
|
@@ -2958,7 +2962,7 @@ type ExampleWithoutIndexSignatures = OmitIndexSignature<Example>;
|
|
|
2958
2962
|
*/
|
|
2959
2963
|
type OmitIndexSignature<ObjectType> = { [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? never : KeyType]: ObjectType[KeyType]; };
|
|
2960
2964
|
//#endregion
|
|
2961
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
2965
|
+
//#region ../../node_modules/.pnpm/type-fest@5.8.0/node_modules/type-fest/source/pick-index-signature.d.ts
|
|
2962
2966
|
/**
|
|
2963
2967
|
Pick only index signatures from the given object type, leaving out all explicitly defined properties.
|
|
2964
2968
|
|
|
@@ -3006,7 +3010,7 @@ type ExampleIndexSignature = PickIndexSignature<Example>;
|
|
|
3006
3010
|
*/
|
|
3007
3011
|
type PickIndexSignature<ObjectType> = { [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? KeyType : never]: ObjectType[KeyType]; };
|
|
3008
3012
|
//#endregion
|
|
3009
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
3013
|
+
//#region ../../node_modules/.pnpm/type-fest@5.8.0/node_modules/type-fest/source/merge.d.ts
|
|
3010
3014
|
// Merges two objects without worrying about index signatures.
|
|
3011
3015
|
type SimpleMerge<Destination, Source> = Simplify<{ [Key in keyof Destination as Key extends keyof Source ? never : Key]: Destination[Key]; } & Source>;
|
|
3012
3016
|
/**
|
|
@@ -3074,11 +3078,10 @@ Note: If you want a merge type that more accurately reflects the runtime behavio
|
|
|
3074
3078
|
type Merge<Destination, Source> = Destination extends unknown // For distributing `Destination`
|
|
3075
3079
|
? Source extends unknown // For distributing `Source`
|
|
3076
3080
|
? If<IsEqual<Destination, Source>, Destination, _Merge<Destination, Source>> : never // Should never happen
|
|
3077
|
-
: never;
|
|
3078
|
-
// Should never happen
|
|
3081
|
+
: never; // Should never happen
|
|
3079
3082
|
type _Merge<Destination, Source> = Simplify<SimpleMerge<PickIndexSignature<Destination>, PickIndexSignature<Source>> & SimpleMerge<OmitIndexSignature<Destination>, OmitIndexSignature<Source>>>;
|
|
3080
3083
|
//#endregion
|
|
3081
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
3084
|
+
//#region ../../node_modules/.pnpm/type-fest@5.8.0/node_modules/type-fest/source/internal/object.d.ts
|
|
3082
3085
|
/**
|
|
3083
3086
|
Merges user specified options with default options.
|
|
3084
3087
|
|
|
@@ -3134,35 +3137,8 @@ type Result = ApplyDefaultOptions<PathsOptions, DefaultPathsOptions, SpecifiedOp
|
|
|
3134
3137
|
type ApplyDefaultOptions<Options extends object, Defaults extends Simplify<Omit<Required<Options>, RequiredKeysOf<Options>> & Partial<Record<RequiredKeysOf<Options>, never>>>, SpecifiedOptions extends Options> = _ApplyDefaultOptions<Options, Defaults, SpecifiedOptions> extends (infer Result extends Required<Options> // `extends Required<Options>` ensures that `ApplyDefaultOptions<SomeOption, ...>` is always assignable to `Required<SomeOption>`
|
|
3135
3138
|
) ? Result : never;
|
|
3136
3139
|
type _ApplyDefaultOptions<Options, Defaults, SpecifiedOptions> = If<IsAny<SpecifiedOptions>, Defaults, If<IsNever<SpecifiedOptions>, Defaults, Merge<Defaults, { [Key in keyof SpecifiedOptions as undefined extends Required<Options>[Key & keyof Options] ? Key : undefined extends SpecifiedOptions[Key] ? never : Key]: SpecifiedOptions[Key]; }>>>;
|
|
3137
|
-
/**
|
|
3138
|
-
Collapses literal types in a union into their corresponding primitive types, when possible. For example, `CollapseLiterals<'foo' | 'bar' | (string & {})>` returns `string`.
|
|
3139
|
-
|
|
3140
|
-
Note: This doesn't collapse literals within tagged types. For example, `CollapseLiterals<Tagged<'foo' | (string & {}), 'Tag'>>` returns `("foo" & Tag<"Tag", never>) | (string & Tag<"Tag", never>)` and not `string & Tag<"Tag", never>`.
|
|
3141
|
-
|
|
3142
|
-
Use-case: For collapsing unions created using {@link LiteralUnion}.
|
|
3143
|
-
|
|
3144
|
-
@example
|
|
3145
|
-
```
|
|
3146
|
-
import type {LiteralUnion} from 'type-fest';
|
|
3147
|
-
|
|
3148
|
-
type A = CollapseLiterals<'foo' | 'bar' | (string & {})>;
|
|
3149
|
-
//=> string
|
|
3150
|
-
|
|
3151
|
-
type B = CollapseLiterals<LiteralUnion<1 | 2 | 3, number>>;
|
|
3152
|
-
//=> number
|
|
3153
|
-
|
|
3154
|
-
type C = CollapseLiterals<LiteralUnion<'onClick' | 'onChange', `on${string}`>>;
|
|
3155
|
-
//=> `on${string}`
|
|
3156
|
-
|
|
3157
|
-
type D = CollapseLiterals<'click' | 'change' | (`on${string}` & {})>;
|
|
3158
|
-
//=> 'click' | 'change' | `on${string}`
|
|
3159
|
-
|
|
3160
|
-
type E = CollapseLiterals<LiteralUnion<'foo' | 'bar', string> | null | undefined>;
|
|
3161
|
-
//=> string | null | undefined
|
|
3162
|
-
```
|
|
3163
|
-
*/
|
|
3164
3140
|
//#endregion
|
|
3165
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
3141
|
+
//#region ../../node_modules/.pnpm/type-fest@5.8.0/node_modules/type-fest/source/except.d.ts
|
|
3166
3142
|
/**
|
|
3167
3143
|
Filter out keys from an object.
|
|
3168
3144
|
|
|
@@ -3193,10 +3169,12 @@ type Filtered = Filter<'bar', 'foo'>;
|
|
|
3193
3169
|
type Filter<KeyType, ExcludeType> = IsEqual<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
|
|
3194
3170
|
type ExceptOptions = {
|
|
3195
3171
|
/**
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
|
|
3172
|
+
Disallow assigning non-specified properties.
|
|
3173
|
+
|
|
3174
|
+
Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`.
|
|
3175
|
+
|
|
3176
|
+
@default false
|
|
3177
|
+
*/
|
|
3200
3178
|
requireExactProps?: boolean;
|
|
3201
3179
|
};
|
|
3202
3180
|
type DefaultExceptOptions = {
|
|
@@ -3260,7 +3238,7 @@ type PostPayloadFixed = Except<UserData, 'email'>;
|
|
|
3260
3238
|
type Except<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions = {}> = _Except<ObjectType, KeysType, ApplyDefaultOptions<ExceptOptions, DefaultExceptOptions, Options>>;
|
|
3261
3239
|
type _Except<ObjectType, KeysType extends keyof ObjectType, Options extends Required<ExceptOptions>> = { [KeyType in keyof ObjectType as Filter<KeyType, KeysType>]: ObjectType[KeyType]; } & (Options['requireExactProps'] extends true ? Partial<Record<KeysType, never>> : {});
|
|
3262
3240
|
//#endregion
|
|
3263
|
-
//#region ../../node_modules/.pnpm/type-fest@5.
|
|
3241
|
+
//#region ../../node_modules/.pnpm/type-fest@5.8.0/node_modules/type-fest/source/require-at-least-one.d.ts
|
|
3264
3242
|
/**
|
|
3265
3243
|
Create a type that requires at least one of the given keys, while keeping the remaining keys as is.
|
|
3266
3244
|
|
|
@@ -3282,12 +3260,14 @@ const responder: RequireAtLeastOne<Responder, 'text' | 'json'> = {
|
|
|
3282
3260
|
|
|
3283
3261
|
@category Object
|
|
3284
3262
|
*/
|
|
3285
|
-
type RequireAtLeastOne<ObjectType, KeysType extends keyof ObjectType = keyof ObjectType> = IfNotAnyOrNever<ObjectType,
|
|
3263
|
+
type RequireAtLeastOne<ObjectType, KeysType extends keyof ObjectType = keyof ObjectType> = IfNotAnyOrNever<ObjectType, {
|
|
3264
|
+
ifNot: If<IsNever<KeysType>, never, _RequireAtLeastOne<ObjectType, If<IsAny<KeysType>, keyof ObjectType, KeysType>>>;
|
|
3265
|
+
}>;
|
|
3286
3266
|
type _RequireAtLeastOne<ObjectType, KeysType extends keyof ObjectType> = { [
|
|
3287
3267
|
// For each `Key` in `KeysType` make a mapped type:
|
|
3288
|
-
// 2. Make all other keys in `KeysType` optional
|
|
3289
3268
|
Key in KeysType]-?: Required<Pick<ObjectType, Key>> // 1. Make `Key`'s type required
|
|
3290
|
-
& Partial<Pick<ObjectType, Exclude<KeysType, Key
|
|
3269
|
+
& Partial<Pick<ObjectType, Exclude<KeysType, Key>>> // 2. Make all other keys in `KeysType` optional
|
|
3270
|
+
; }[KeysType] & Except<ObjectType, KeysType>; // 3. Add the remaining keys not in `KeysType`
|
|
3291
3271
|
//#endregion
|
|
3292
3272
|
//#region src-js/plugins/fix.d.ts
|
|
3293
3273
|
type FixFn = (fixer: Fixer) => Fix | Array<Fix | null | undefined> | IterableIterator<Fix | null | undefined> | null | undefined;
|
|
@@ -3355,9 +3335,6 @@ interface SuggestionBase {
|
|
|
3355
3335
|
data?: DiagnosticData | null | undefined;
|
|
3356
3336
|
fix: FixFn;
|
|
3357
3337
|
}
|
|
3358
|
-
/**
|
|
3359
|
-
* Suggested fix in form sent to Rust.
|
|
3360
|
-
*/
|
|
3361
3338
|
//#endregion
|
|
3362
3339
|
//#region src-js/plugins/source_code.d.ts
|
|
3363
3340
|
declare const SOURCE_CODE: Readonly<{
|