Packages

A package is a circuit module distributed on npm: npm install a voltage regulator, an MCU subsystem, or a complete reference design, and one constructor call drops the whole sub-circuit — parts, passives, connections, and placement — onto the board. To publish your own, see Package authoring.

workflow

using a package

Packages are installed in the hw/ directory — that's where the build runs. Import the class, construct it with a PCB and a position, and create its components like any others.

Example first

terminal
cd hw
npm install @typecad/rd-bq24210
board.ts
import { PCB } from '@typecad/pcb';
import { RD_BQ24210 } from '@typecad/rd-bq24210';

let typecad = new PCB('solar_charger');

let charger = new RD_BQ24210({
  pcb: typecad,
  x: 40,
  y: 30,          // where the module lands on the board
});

// wire to the module like any other component
typecad.named('VBUS').net(charger.VBUS, j1.pin(1));
typecad.create(...charger.components);

Everything inside the package is reachable as public properties — read pins to wire to it, exactly like a generated component file:

Constructor options

OptionTypeDescription
pcbPCBrequired — the board the package lands on
x, ynumberrequired — where the module sits; every part inside is offset from it
referencestringReference prefix override
namestringThe KiCAD group name (defaults to the class name)
passiveSizePassiveSizeChip size the package’s built-in passives use (default ’0603’)
passivesPassiveFactorySwap the passive factories out entirely

Do not populate

Individual parts of a package can be marked DNP after construction — they stay in the schematic but drop out of the BOM and assembly:

dnp.ts
charger.STATUS_LED.dnp = true;   // keep it in the design, skip it in the BOM

Custom options

Packages define their own options alongside the standard ones — a charger might take a sense resistor value, a regulator its output voltage:

options.ts
// package side — options extend PackageOptions
export class RD_BQ24210 extends Package<{ isense?: number }> { ... }

// consumer side — they arrive as constructor options
let charger = new RD_BQ24210({ pcb: typecad, x: 40, y: 30, isense: 0.05 });
© 2026 typeCAD — code-defined electronics github