Public types
Import from the package root to preserve dependency contracts:
import { JSD, SerialStatus } from '@danidoble/serial-node-jsd';
import type {
JSDConfig, JSDOptions, JSDTransport, JSDParser, JSDParserFactory, JSDHandshake,
PortFilter, SerialPortInfo, SendOptions,
SerialConfig, SerialCoreEvents, SerialPortOpenOptions, DelimiterOptions,
JSDEvents, VisionEvents, LicensingEvents, ManifestEvents, MdbCardHolderEvents
} from '@danidoble/serial-node-jsd';
type MachineStatusPayload = JSDEvents['vision:machine-status'][0];
type StatusListener = (...args: JSDEvents['vision:machine-status']) => void;Cross-dependency typing
JSDConfig = SerialConfig comes directly from serial-core. JSDParser, JSDParserFactory and JSDHandshake derive from that config. PortFilter, SerialPortInfo and SendOptions retain serial-core 0.3.0's discovery and command contracts. SendOptions describes serial-core sends; JSD does not expose a raw send method. SerialPortOpenOptions and DelimiterOptions come from serialport. Re-exporting a port type does not mean the JSD constructor accepts every serialport option; it accepts SerialConfig.
SerialCoreEvents uses callback signatures. JSD event maps use argument tuples. The runtime SerialStatus constant is available from the root; for its value union:
type StatusValue = (typeof SerialStatus)[keyof typeof SerialStatus];Domain types and namespaces
The root exports JSD operation options, machine/range types, licensing events, manifest types, MDB types, and selected Vision options. Namespaces JsdTypes, TransportTypes, VisionTypes, visionTypes, LicensingTypes, ManifestTypes, and MdbCardHolderTypes preserve access to their respective type modules. Prefer VisionTypes for consistent capitalization.
The type reference includes internal helper definitions as context; not every helper is a named root export. Avoid importing private source paths from an installed package.
ESM and CommonJS
The package maps ESM to index.mjs/index.d.mts and CommonJS to index.cjs/index.d.cts. Your IDE resolves the matching declarations automatically. Use TypeScript's node16, nodenext, or bundler resolution as appropriate for your application.