Skip to main content

observablejs.types

observablejs.types publishes annotations for advanced inputs and synchronized state.

import observablejs as obs

file: obs.types.FileSpec = {
"url": "https://example.test/data.csv",
"mimeType": "text/csv",
}

document: obs.types.ObservableDocument = {
"title": "Report",
"nodes": [{"id": 1, "mode": "js", "value": "answer = 42"}],
}

Input contracts

TypeContract
CellMode, CellFormatSupported Notebook Kit cell modes and file formats.
CellSelectorString key, authored Cell, or notebook-owned NotebookCell.
NotebookTheme, ThemePair, ThemeTheme names and light or dark pairs.
FileSpec, FileInputFile input record, URL, or filesystem path.
NotebookKitCellMetadataMode metadata for database, format, and since.
ObservableDocument, ObservableNode, ObservableFileObservableHQ document API records.
ObservableSource, ObservableData, ObservableDisplayNested ObservableHQ source and display records.

Runtime parsing remains defensive when JSON data does not match an annotation.

State contracts

CellStatus is pending, success, or error. ErrorPhase is analysis, evaluation, rendering, or serialization.

The immutable records are:

  • NotebookState
  • ViewState
  • CellResult
  • CellError
  • ViewError
  • BrowserErrorValue

FileSnapshot and ThemeSnapshot describe the read-only mappings inside NotebookState.

See Notebook for controller snapshots and View state and graph for browser revisions and results.