Skip to content

Commit 05fc504

Browse files
committed
do not break everything
1 parent 05a2e53 commit 05fc504

File tree

1 file changed

+18
-14
lines changed

1 file changed

+18
-14
lines changed

packages/snaps-sdk/src/jsx/validation.ts

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -507,20 +507,6 @@ export const FieldStruct: Describe<FieldElement> = element('Field', {
507507
children: FieldChildStruct,
508508
});
509509

510-
export const BoxChildrenStruct = children(
511-
// eslint-disable-next-line @typescript-eslint/no-use-before-define
512-
[lazy(() => BoxChildStruct)],
513-
) as unknown as Struct<SnapsChildren<GenericSnapElement>, null>;
514-
515-
/**
516-
* A struct for the {@link FormElement} type.
517-
*/
518-
export const FormStruct: Describe<FormElement> = element('Form', {
519-
// eslint-disable-next-line @typescript-eslint/no-use-before-define
520-
children: BoxChildrenStruct,
521-
name: string(),
522-
});
523-
524510
/**
525511
* A struct for the {@link BoldElement} type.
526512
*/
@@ -559,6 +545,11 @@ export const AvatarStruct = element('Avatar', {
559545
size: optional(nullUnion([literal('sm'), literal('md'), literal('lg')])),
560546
}) as unknown as Struct<AvatarElement, null>;
561547

548+
export const BoxChildrenStruct = children(
549+
// eslint-disable-next-line @typescript-eslint/no-use-before-define
550+
[lazy(() => BoxChildStruct)],
551+
) as unknown as Struct<SnapsChildren<GenericSnapElement>, null>;
552+
562553
/**
563554
* A struct for the {@link BoxElement} type.
564555
*/
@@ -577,6 +568,19 @@ export const BoxStruct: Describe<BoxElement> = element('Box', {
577568
center: optional(boolean()),
578569
});
579570

571+
/**
572+
* A subset of JSX elements that are allowed as children of the Form component.
573+
*/
574+
export const FormChildStruct = BoxChildrenStruct;
575+
576+
/**
577+
* A struct for the {@link FormElement} type.
578+
*/
579+
export const FormStruct: Describe<FormElement> = element('Form', {
580+
children: FormChildStruct,
581+
name: string(),
582+
});
583+
580584
const FooterButtonStruct = refine(ButtonStruct, 'FooterButton', (value) => {
581585
if (
582586
typeof value.props.children === 'string' ||

0 commit comments

Comments
 (0)