Skip to content

Commit

Permalink
Merge pull request #72 from tscircuit/add-is-junction
Browse files Browse the repository at this point in the history
Add schematic_trace.edges[*].is_crossing
  • Loading branch information
seveibar authored Nov 8, 2024
2 parents 4c2ca82 + ef27d62 commit e9b3509
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_crossing?: 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_crossing: 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 e9b3509

Please sign in to comment.