Skip to content

Commit

Permalink
add is_junction
Browse files Browse the repository at this point in the history
  • Loading branch information
seveibar committed Nov 8, 2024
1 parent 4c2ca82 commit 7db90ac
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion src/schematic/schematic_trace.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,27 @@
import { z } from "zod"
import { distance } from "../units"
import { expectTypesMatch } from "src/utils/expect-types-match"

export interface SchematicTraceEdge {
from: {
x: number
y: number
}
to: {
x: number
y: number
}
is_junction?: boolean
from_schematic_port_id?: string
to_schematic_port_id?: string
}

export interface SchematicTrace {
type: "schematic_trace"
schematic_trace_id: string
source_trace_id: string
edges: SchematicTraceEdge[]
}

export const schematic_trace = z.object({
type: z.literal("schematic_trace"),
Expand All @@ -15,11 +37,14 @@ export const schematic_trace = z.object({
x: z.number(),
y: z.number(),
}),
is_junction: z.boolean().optional(),
from_schematic_port_id: z.string().optional(),
to_schematic_port_id: z.string().optional(),
}),
),
})

export type SchematicTraceInput = z.input<typeof schematic_trace>
export type SchematicTrace = z.infer<typeof schematic_trace>
type InferredSchematicTrace = z.infer<typeof schematic_trace>

expectTypesMatch<SchematicTraceInput, InferredSchematicTrace>(true)

0 comments on commit 7db90ac

Please sign in to comment.