Skip to content

tscircuit/soup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

70 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@tscircuit/soup

tscircuit · Soup Specification Docs

npm version

“tscircuit soup” is the name of the compiled intermediary low-level JSON circuit representation. It contains all the information needed to visually represent a schematic, PCB, produce Gerber files, produce bill of materials, run SPICE simulations, view warnings and more. It is designed to easily interoperate with a SQL database.

This module has the zod definitions and conversion functions for using tscircuit soup.

[!INFO] This is mostly an internal module, you probably want to use the main tscircuit library instead.

import { any_soup_element, simple_source_resistor } from "@tscircuit/soup"
import type { SourceSimpleResistor } from "@tscircuit/soup"

const resistor: SourceSimpleResistor = simple_source_resistor.parse({
  type: "source_component",
  ftype: "simple_resistor",
  source_component_id: "source_component_1",
  name: "R1",
  resistane: "1k",
})

console.log(resistor.resistance) // 1000

// This is the common way to parse/transform any element
any_soup_element.parse({
  /* ... */
})