Registry / storage / cheminfo-types

cheminfo-types

JSON →
library1.15.0jsnpmunverified

TypeScript type definitions and data schemas for cheminfo packages and related chemistry data. Current stable version: 1.15.0, released periodically. This package provides a unified type system shared across the cheminfo ecosystem, covering spectra, measurements, molecules, and other chemical data structures. It is dependency-free and ships exclusively TypeScript types. Unlike ad-hoc type definitions, cheminfo-types enforces a consistent schema with JSON schema integration and `@tjs-examples` for documentation generation. It is designed primarily for internal use within cheminfo projects but is open to external contributions.

storage
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

This package exports only types; use `import type` to avoid runtime inclusion. In TypeScript 3.8+ with `isolatedModules`, using `import type` is required.

import type { MeasurementXY } from 'cheminfo-types'

Same as above. Use `import type` for all symbols.

import type { Spectrum1D } from 'cheminfo-types'

CommonJS require is not supported for type-only imports. Always use ES import instead.

import type { MeasurementBase } from 'cheminfo-types'

Demonstrates importing and using the MeasurementXY type to create a measurement object with x and y variables.

import type { MeasurementXY } from 'cheminfo-types'; const xAxis = { label: 'time', units: 's', isDependent: false, data: [1, 2, 3], }; const yAxis = { label: 'current', units: 'mA', isDependent: true, data: [0.1, 8, 13], }; const firstMeasurement: MeasurementXY = { title: 'Current Monitoring', variables: { x: xAxis, y: yAxis }, }; console.log(firstMeasurement.variables.x.data[0]); // 1
Debug
Known footguns
deprecatedThe type `Spectrum1D` is deprecated since version 0.10.0 in favor of `MeasurementXY`.
deprecatedThe type `Measurement2D` is deprecated since version 0.10.0 in favor of `MeasurementXY`.
gotchaImporting types must use `import type` syntax, not regular `import`. Using regular import will cause a TypeScript compilation error if the package is not installed as a dependency.
gotchaThis package does not export runtime JavaScript; it only provides TypeScript types. Using `require('cheminfo-types')` will return an empty object.
Upgrade
Version history

Breaking-change detection hasn't run for this library yet.

Audit
Security & dependencies

CVE tracking and dependency tree are planned for a later release.

Agent activity
19 hits · last 30 days
bytedance
4
gptbot
3
amazonbot
3
ahrefsbot
1
Resources