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.

npm install cheminfo-types
INSTALL
IMPORT
SIG · CHEMINFO-TYPES
C
cheminfo-types
storagejavascriptv1.15.0
harness data pending
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.

MeasurementXY
import type { MeasurementXY } from 'cheminfo-types'
import { MeasurementXY } from 'cheminfo-types'
This package exports only types; use `import type` to avoid runtime inclusion. In TypeScript 3.8+ with `isolatedModules`, using `import type` is required.
Spectrum1D
import type { Spectrum1D } from 'cheminfo-types'
import { Spectrum1D } from 'cheminfo-types'
Same as above. Use `import type` for all symbols.
MeasurementBase
import type { MeasurementBase } from 'cheminfo-types'
const MeasurementBase = require('cheminfo-types').MeasurementBase
CommonJS require is not supported for type-only imports. Always use ES import instead.

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 issues
deprecatedThe type `Spectrum1D` is deprecated since version 0.10.0 in favor of `MeasurementXY`.
fix
Replace `Spectrum1D` with `MeasurementXY` and adjust property names accordingly.
affects: >=0.10.0
deprecatedThe type `Measurement2D` is deprecated since version 0.10.0 in favor of `MeasurementXY`.
fix
Replace `Measurement2D` with `MeasurementXY` and adjust property names accordingly.
affects: >=0.10.0
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.
fix
Use `import type { ... } from 'cheminfo-types'`.
affects: >=1.0.0
gotchaThis package does not export runtime JavaScript; it only provides TypeScript types. Using `require('cheminfo-types')` will return an empty object.
fix
Use ES module `import type` syntax, not CommonJS require.
affects: >=1.0.0
Errors
Common errors & fixes
Type error: Module '"cheminfo-types"' has no exported member 'MeasurementXY'. Did you mean to use 'import type'?
Using regular `import` instead of `import type` in a project with `isolatedModules` enabled.
fix
Change `import { MeasurementXY } from 'cheminfo-types'` to `import type { MeasurementXY } from 'cheminfo-types'`.
Cannot find module 'cheminfo-types' or its corresponding type declarations.
The package is not installed or the importing file is not considered a module (e.g., missing 'import' or 'export' in file).
fix
Run `npm install cheminfo-types` and ensure the file has at least one top-level `import` or `export` statement.
Upgrade
Version history
1.15.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
23 hits · last 30 days
node
22
OpenAI (training)
1
Resources
cheminfo-types — npm install cheminfo-types · libregistry