Skip to content

phet-io-types

Overview

General TypeScript types that apply to PhET-iO features and architecture.

@author Michael Kauzmann (PhET Interactive Simulations) @author Sam Reid (PhET Interactive Simulations)

Type AbstractPhetioAPI

Abstraction for flattened or treelike PhetioAPI

import type { AbstractPhetioAPI } from 'scenerystack/tandem';

Type CompositeStateSchemaAPI

import type { CompositeStateSchemaAPI } from 'scenerystack/tandem';

Record<string, IOTypeName>

Type FlattenedAPIPhetioElements

The PhET-iO API as it is easiest to use in code. This takes PhetioAPI type (nested elements) and "expands" (flattens) each out so that the keys are phetioIDs.

import type { FlattenedAPIPhetioElements } from 'scenerystack/tandem';

Record<PhetioID, PhetioElement>

Type FullPhetioState

import type { FullPhetioState } from 'scenerystack/tandem';

Record<PhetioID, PhetioElementState | "DELETED">

Type IOTypeName

import type { IOTypeName } from 'scenerystack/tandem';

string

Type Method

import type { Method } from 'scenerystack/tandem';
  • returnType: string
  • parameterTypes: string[]
  • documentation: string
  • invocableForReadOnlyElements?: boolean

Type Methods

import type { Methods } from 'scenerystack/tandem';

Record<string, Method>

Type PhetioAPI

The PhET-iO API json structure as it appears in the api files. This nests PhET-iO Elements like the Studio tree, in part to save space in the file.

import type { PhetioAPI } from 'scenerystack/tandem';

AbstractPhetioAPI & { phetioElements: PhetioElements }

Type PhetioAPIVersion

import type { PhetioAPIVersion } from 'scenerystack/tandem';
  • major: number
  • minor: number

Type PhetioElement

import type { PhetioElement } from 'scenerystack/tandem';

Type PhetioElementData

import type { PhetioElementData } from 'scenerystack/tandem';

Type PhetioElementMetadata

import type { PhetioElementMetadata } from 'scenerystack/tandem';
  • phetioState: boolean
    Used in PhetioObjectOptions
  • phetioReadOnly: boolean
  • phetioEventType: string
  • phetioDocumentation: string
  • phetioHighFrequency: boolean
  • phetioPlayback: boolean
  • phetioFeatured?: boolean
  • phetioDynamicElement: boolean
  • phetioDesigned: boolean
  • phetioTypeName: IOTypeName
    Specific to Metadata
  • phetioIsArchetype: boolean
  • phetioArchetypePhetioID?: string | null
  • phetioDynamicElementName?: string | null
    For PhetioDynamicElementContainer.

Type PhetioElementMetadataValue

import type { PhetioElementMetadataValue } from 'scenerystack/tandem';

PhetioElementMetadata[keyof PhetioElementMetadata]

Type PhetioElements

In tree structure

import type { PhetioElements } from 'scenerystack/tandem';

Type PhetioElementState

The "top level" state associated with a phetioID in state. This is NOT and never should be a "substate" or nested. value within a top-level state.

import type { PhetioElementState } from 'scenerystack/tandem';

Record<string, IntentionalAny>

Type PhetioID

import type { PhetioID } from 'scenerystack/tandem';

string

Type PhetioOverrides

import type { PhetioOverrides } from 'scenerystack/tandem';

Record<string, Partial<PhetioElementMetadata>>

Type PhetioState

import type { PhetioState } from 'scenerystack/tandem';

Record<PhetioID, PhetioElementState>

Type PhetioType

The API schema, for the actual class on the sim side see IOType.ts

import type { PhetioType } from 'scenerystack/tandem';

Type PhetioTypes

import type { PhetioTypes } from 'scenerystack/tandem';

Record<IOTypeName, PhetioType>

Type StateSchemaAPI

import type { StateSchemaAPI } from 'scenerystack/tandem';

string | CompositeStateSchemaAPI

Source Code

See the source for phet-io-types.ts in the tandem repository.