diff --git a/README.md b/README.md index 21838233..74f9910d 100644 --- a/README.md +++ b/README.md @@ -1672,6 +1672,7 @@ export interface SchematicSectionProps { displayName?: string; name: string; sectionTitleFontSize?: number | string; + children?: any; } ``` diff --git a/generated/COMPONENT_TYPES.md b/generated/COMPONENT_TYPES.md index 391e4185..03a3bb76 100644 --- a/generated/COMPONENT_TYPES.md +++ b/generated/COMPONENT_TYPES.md @@ -3692,11 +3692,13 @@ export interface SchematicSectionProps { displayName?: string name: string sectionTitleFontSize?: number | string + children?: any } export const schematicSectionProps = z.object({ displayName: z.string().optional(), name: z.string(), sectionTitleFontSize: distance.optional(), + children: z.any().optional(), }) ``` diff --git a/generated/PROPS_OVERVIEW.md b/generated/PROPS_OVERVIEW.md index 524439cf..ca4d3f8c 100644 --- a/generated/PROPS_OVERVIEW.md +++ b/generated/PROPS_OVERVIEW.md @@ -2089,6 +2089,7 @@ export interface SchematicSectionProps { displayName?: string name: string sectionTitleFontSize?: number | string + children?: any } diff --git a/lib/components/schematic-section.ts b/lib/components/schematic-section.ts index 425ccee3..52814eac 100644 --- a/lib/components/schematic-section.ts +++ b/lib/components/schematic-section.ts @@ -6,12 +6,14 @@ export interface SchematicSectionProps { displayName?: string name: string sectionTitleFontSize?: number | string + children?: any } export const schematicSectionProps = z.object({ displayName: z.string().optional(), name: z.string(), sectionTitleFontSize: distance.optional(), + children: z.any().optional(), }) export type InferredSchematicSectionProps = z.input< diff --git a/tests/schematic-section.test.ts b/tests/schematic-section.test.ts new file mode 100644 index 00000000..43495c8c --- /dev/null +++ b/tests/schematic-section.test.ts @@ -0,0 +1,18 @@ +import { expect, test } from "bun:test" +import { + schematicSectionProps, + type SchematicSectionProps, +} from "lib/components/schematic-section" +import { expectTypeOf } from "expect-type" + +test("should parse schematic section children", () => { + const raw: SchematicSectionProps = { + name: "power", + displayName: "Power", + children: [{ type: "resistor", props: { name: "R1" } }], + } + + expectTypeOf(raw).toMatchTypeOf() + const parsed = schematicSectionProps.parse(raw) + expect(parsed.children).toEqual([{ type: "resistor", props: { name: "R1" } }]) +})