Skip to content

Commit

Permalink
add simple_switch (#130)
Browse files Browse the repository at this point in the history
* add simple switch

* format code
  • Loading branch information
techmannih authored Feb 11, 2025
1 parent 47dc979 commit c0617de
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/source/any_source_component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { source_simple_pin_header } from "./source_simple_pin_header"
import { source_simple_resonator } from "./source_simple_resonator"
import { source_simple_transistor } from "./source_simple_transistor"
import { source_simple_mosfet } from "./source_simple_mosfet"
import { source_simple_switch } from "./source_simple_switch"

export const any_source_component = z.union([
source_simple_resistor,
Expand All @@ -33,6 +34,7 @@ export const any_source_component = z.union([
source_simple_crystal,
source_simple_pin_header,
source_simple_resonator,
source_simple_switch,
source_simple_transistor,
source_simple_mosfet,
])
Expand Down
1 change: 1 addition & 0 deletions src/source/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@ export * from "./source_simple_potentiometer"
export * from "./source_simple_crystal"
export * from "./source_simple_pin_header"
export * from "./source_simple_resonator"
export * from "./source_simple_switch"
export * from "./source_simple_transistor"
export * from "./source_simple_mosfet"
21 changes: 21 additions & 0 deletions src/source/source_simple_switch.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { z } from "zod"
import {
source_component_base,
type SourceComponentBase,
} from "src/source/base/source_component_base"
import { expectTypesMatch } from "src/utils/expect-types-match"

export const source_simple_switch = source_component_base.extend({
ftype: z.literal("simple_switch"),
})
export type SourceSimpleSwitchInput = z.input<typeof source_simple_switch>
type InferredSourceSimpleSwitch = z.infer<typeof source_simple_switch>

/**
* Defines a simple switch component
*/
export interface SourceSimpleSwitch extends SourceComponentBase {
ftype: "simple_switch"
}

expectTypesMatch<SourceSimpleSwitch, InferredSourceSimpleSwitch>(true)

0 comments on commit c0617de

Please sign in to comment.