resolveAttrTypeSpec

Resolves an attribute's declared type to its underlying spec, across the base library and every registered environment.

@internote/canvas-sdkFunction
On this page
import { resolveAttrTypeSpec } from '@internote/canvas-sdk';

An editing surface reads this to decide what control an attribute deserves: an enum is a menu, a bool is a checkbox, a float is a number, and a string-backed custom type is typed text.

It consults both tables because the type table has two halves. The language declares colour, duration and ratio; an environment declares its own, such as an axis format. Asking the base library alone about an environment's type gives the name back rather than the shape.

#Signature

(type: unknown): { base: string; values?: string[]; } | null

#Parameters

type
The type as an attribute spec declares it: a name, or an inline spec.

#Returns

The spec's base kind and, for an enum, its values; null when the type cannot be resolved.

Declared in packages/canvas-sdk/src/environment/registry.ts:253.

Last updated