defineEnvironment
Checks an environment definition's shape and returns it unchanged.
@internote/canvas-sdkOn this page
import { defineEnvironment } from '@internote/canvas-sdk';The check runs when the definition is written, before anything is registered, so a malformed environment fails at import time with a message naming the field. It throws when name or Surface is missing, when a declared storage tier is neither session nor session+db, when a compile spec names another environment, or when an animation verb names no vocabulary element.
#Signature
(def: EnvironmentDefinition): EnvironmentDefinition#Parameters
defThe definition to check.
#Returns
The same definition object, typed as an EnvironmentDefinition.
#Example
export const greetingEnvironment = defineEnvironment({
name: 'greeting',
attributes: { size: { type: 'float', default: 1, animatable: 'number' } },
Surface: GreetingSurface,
});Declared in packages/canvas-sdk/src/environment/defineEnvironment.ts:34.