Skip to content

Commit

Permalink
chore: Update type definitions for FormElementField and FormField com…
Browse files Browse the repository at this point in the history
…ponents
  • Loading branch information
jeannemas committed May 12, 2024
1 parent 93c9e46 commit 6f67863
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .changeset/eleven-squids-repeat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@jeanne-mas/svelte-ui': patch
---

Fixed missing types
7 changes: 4 additions & 3 deletions src/lib/components/form/FormElementField.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import { tv } from 'tailwind-variants';
import { castAsAny } from '$lib/utils/internal.js';
import type { AnyObject, ComponentInfo } from '$lib/utils/types.js';
import type { AnyObject, ComponentInfo, ObjectOf } from '$lib/utils/types.js';
type Primitive<T extends AnyObject, U extends FormPathLeaves<T>> = ComponentInfo<
ElementField<T, U>
Expand All @@ -28,8 +28,9 @@
* The slots of the element field.
*/
export type Slots<T extends AnyObject, U extends FormPathLeaves<T>> = {
default: Omit<Primitive<T, U>['slots']['default'], 'value'> & {
// Manual omission to prevent infinite loop while compiling the package
default: Omit<Primitive<T, U>['slots']['default'], 'constraints' | 'value'> & {
// Manual omissions to prevent infinite loop while compiling the package
constraints: ObjectOf<unknown>;
value: unknown;
};
};
Expand Down
7 changes: 4 additions & 3 deletions src/lib/components/form/FormField.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import { tv } from 'tailwind-variants';
import { castAsAny } from '$lib/utils/internal.js';
import type { AnyObject, ComponentInfo, EmptyObject } from '$lib/utils/types.js';
import type { AnyObject, ComponentInfo, EmptyObject, ObjectOf } from '$lib/utils/types.js';
type Primitive<T extends AnyObject, U extends FormPath<T>> = ComponentInfo<Field<T, U>>;
Expand All @@ -26,8 +26,9 @@
* The slots of the field.
*/
export type Slots<T extends AnyObject, U extends FormPath<T>> = {
default: Omit<Primitive<T, U>['slots']['default'], 'value'> & {
// Manual omission to prevent infinite loop while compiling the package
default: Omit<Primitive<T, U>['slots']['default'], 'constraints' | 'value'> & {
// Manual omissions to prevent infinite loop while compiling the package
constraints: ObjectOf<unknown>;
value: unknown;
};
};
Expand Down

0 comments on commit 6f67863

Please sign in to comment.