Types
Every value that exists inside a StaticJs sandbox is a StaticJsValue. The type system mirrors JavaScript's own primitives and objects, but wraps them so the host can inspect, create, and manipulate sandbox values safely without executing untrusted code directly.
All types carry a realm reference and implement the StaticJsPrimitive base interface. Object-like types additionally implement StaticJsObject, which provides the full ECMAScript internal-method API ([[Get]], [[Set]], [[DefineOwnProperty]], etc.) as async/sync/evaluator triplets.
Inheritance diagram
Union types
Two union types group related concrete types for type-narrowing purposes:
StaticJsValue
StaticJsValue is a type representing every possible StaticJs value. Use isStaticJsValue to check, or the more specific guards below to narrow further.
StaticJsValue = StaticJsScalar | StaticJsPlainObject | StaticJsArray | StaticJsFunction | ...
StaticJsScalar
StaticJsScalar covers the non-compound types. All StaticJsScalar types include a .value property reflecting the native, non-sandbox value. Use isStaticJsScalar to narrow to any scalar.
StaticJsScalar = StaticJsString | StaticJsNumber | StaticJsBoolean
| StaticJsNull | StaticJsUndefined | StaticJsSymbol
StaticJsSymbol appears in both the StaticJsScalar union (it is a primitive in JavaScript) and extends StaticJsObject in the interface hierarchy (so the sandbox can support Symbol.prototype method access internally). isStaticJsScalar returns true for symbols; isStaticJsObject also returns true for them.
Type reference
All type guards and types are importable from @suntime-js/core.