@formisch/preact 0.9.1 → 0.9.2

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.
Files changed (2) hide show
  1. package/dist/index.d.ts +12 -8
  2. package/package.json +3 -3
package/dist/index.d.ts CHANGED
@@ -187,23 +187,27 @@ declare const INTERNAL: "~internal";
187
187
  /**
188
188
  * Checks if a type is `any`.
189
189
  */
190
- type IsAny<Type> = 0 extends 1 & Type ? true : false;
190
+ type IsAny<T> = 0 extends 1 & T ? true : false;
191
191
  /**
192
192
  * Checks if a type is `never`.
193
193
  */
194
- type IsNever<Type> = [Type] extends [never] ? true : false;
194
+ type IsNever<T> = [T] extends [never] ? true : false;
195
195
  /**
196
196
  * Constructs a type that is maybe a promise.
197
197
  */
198
- type MaybePromise<TValue> = TValue | Promise<TValue>;
198
+ type MaybePromise<T> = T | Promise<T>;
199
199
  /**
200
200
  * Makes all properties deeply optional.
201
201
  */
202
- type DeepPartial<TValue> = TValue extends Record<PropertyKey, unknown> | readonly unknown[] ? { [Key in keyof TValue]?: DeepPartial<TValue[Key]> | undefined } : TValue | undefined;
202
+ type DeepPartial<TValue> = TValue extends Record<PropertyKey, unknown> | readonly unknown[] ? { [TKey in keyof TValue]?: DeepPartial<TValue[TKey]> | undefined } : TValue | undefined;
203
203
  /**
204
204
  * Makes all value properties optional.
205
+ *
206
+ * Hint: For dynamic arrays, only plain objects and nested arrays have their
207
+ * values made optional. Primitives and class instances are kept as-is to avoid
208
+ * types like `(string | undefined)[]`.
205
209
  */
206
- type PartialValues<TValue> = TValue extends Record<PropertyKey, unknown> | readonly unknown[] ? { [Key in keyof TValue]: PartialValues<TValue[Key]> } : TValue | undefined;
210
+ type PartialValues<TValue> = TValue extends readonly (infer TItem)[] ? number extends TValue["length"] ? (TItem extends Record<PropertyKey, unknown> | readonly unknown[] ? { [TKey in keyof TItem]: PartialValues<TItem[TKey]> } : TItem)[] : { [TKey in keyof TValue]: PartialValues<TValue[TKey]> } : TValue extends Record<PropertyKey, unknown> ? { [TKey in keyof TValue]: PartialValues<TValue[TKey]> } : TValue | undefined;
207
211
  //#endregion
208
212
  //#region src/types/form.d.ts
209
213
  /**
@@ -238,7 +242,7 @@ interface InternalFormStore<TSchema extends Schema = Schema> extends InternalObj
238
242
  /**
239
243
  * The element of the form.
240
244
  */
241
- element?: HTMLFormElement;
245
+ element?: HTMLFormElement | undefined;
242
246
  /**
243
247
  * The number of active validators.
244
248
  */
@@ -312,7 +316,7 @@ type KeyOf<TValue> = IsAny<TValue> extends true ? never : TValue extends readonl
312
316
  * properties that do not exist in all union options are not accessible
313
317
  * and result in "any" when accessed.
314
318
  */
315
- type MergeUnion<T> = { [K in KeyOf<T>]: T extends Record<K, infer V> ? V : never };
319
+ type MergeUnion<TValue> = { [TKey in KeyOf<TValue>]: TValue extends Record<TKey, infer TItem> ? TItem : never };
316
320
  /**
317
321
  * Lazily evaluates only the first valid path segment based on the given value.
318
322
  */
@@ -644,7 +648,7 @@ interface ResetFieldConfig<TSchema extends Schema, TFieldPath extends RequiredPa
644
648
  * The new initial input to reset the field to. If provided, replaces the
645
649
  * field's initial input.
646
650
  */
647
- readonly initialInput?: DeepPartial<PathValue<v.InferInput<TSchema>, TFieldPath>>;
651
+ readonly initialInput?: DeepPartial<PathValue<v.InferInput<TSchema>, TFieldPath>> | undefined;
648
652
  }
649
653
  /**
650
654
  * Resets a specific field or the entire form to its initial state. Provides
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@formisch/preact",
3
3
  "description": "The modular and type-safe form library for Preact",
4
- "version": "0.9.1",
4
+ "version": "0.9.2",
5
5
  "license": "MIT",
6
6
  "author": "Fabian Hiller",
7
7
  "homepage": "https://formisch.dev",
@@ -42,9 +42,9 @@
42
42
  "typescript": "^5.8.3",
43
43
  "valibot": "^1.2.0",
44
44
  "vite": "^6.0.4",
45
- "@formisch/eslint-config": "0.1.0",
45
+ "@formisch/core": "0.6.2",
46
46
  "@formisch/methods": "0.7.0",
47
- "@formisch/core": "0.6.1"
47
+ "@formisch/eslint-config": "0.1.0"
48
48
  },
49
49
  "peerDependencies": {
50
50
  "@preact/signals": "^2.0.0",