API reference / @jsprismarine/script-host / shape/format
shape/format
Interfaces
ArrayType
Defined in: script-host/src/shape/format.ts:73
An array of one element type.
Properties
element
readonlyelement:ShapeType
Defined in: script-host/src/shape/format.ts:75
kind
readonlykind:"array"
Defined in: script-host/src/shape/format.ts:74
ClassDeclaration
Defined in: script-host/src/shape/format.ts:209
A class. Its base is another class it extends.
Properties
base?
readonlyoptionalbase?:string|ExternalType
Defined in: script-host/src/shape/format.ts:211
conditions?
readonlyoptionalconditions?: readonlystring[]
Defined in: script-host/src/shape/format.ts:215
runtime_conditions: names of the conditions the class needs, such as Poi in a beta.
iterator?
readonlyoptionaliterator?:object
Defined in: script-host/src/shape/format.ts:213
What the class's iterator yields, for a class a script can iterate.
throws?
readonlyoptionalthrows?: readonlyErrorReference[]
type
readonlytype:ShapeType
kind
readonlykind:"class"
Defined in: script-host/src/shape/format.ts:210
ClosureType
Defined in: script-host/src/shape/format.ts:86
A function a script passes in, and the privilege it runs under when one is recorded.
Properties
arguments
readonlyarguments: readonlyShapeType[]
Defined in: script-host/src/shape/format.ts:88
kind
readonlykind:"closure"
Defined in: script-host/src/shape/format.ts:87
privilege?
readonlyoptionalprivilege?: readonlyPrivilege[]
Defined in: script-host/src/shape/format.ts:90
returns
readonlyreturns:ShapeType
Defined in: script-host/src/shape/format.ts:89
ConstantDeclaration
Defined in: script-host/src/shape/format.ts:241
A module-level constant, such as TicksPerSecond.
Properties
kind
readonlykind:"constant"
Defined in: script-host/src/shape/format.ts:242
type
readonlytype:ShapeType
Defined in: script-host/src/shape/format.ts:243
value
readonlyvalue:string|number|boolean
Defined in: script-host/src/shape/format.ts:244
DeclarationHistory
Defined in: script-host/src/shape/format.ts:273
A declaration's history, and each member's.
Properties
members?
readonlyoptionalmembers?:Readonly<Record<string, readonlySegment<ShapeMember>[]>>
Defined in: script-host/src/shape/format.ts:275
segments
readonlysegments: readonlySegment<ShapeDeclaration>[]
Defined in: script-host/src/shape/format.ts:274
EnumDeclaration
Defined in: script-host/src/shape/format.ts:225
An enum: an object of constants.
Properties
kind
readonlykind:"enum"
Defined in: script-host/src/shape/format.ts:226
ErrorDeclaration
Defined in: script-host/src/shape/format.ts:230
An error class. Its members are its properties.
Properties
kind
readonlykind:"error"
Defined in: script-host/src/shape/format.ts:231
ExternalType
Defined in: script-host/src/shape/format.ts:46
A class, interface, enum or error of another module, such as @minecraft/common's EngineError.
Properties
kind
readonlykind:"external"
Defined in: script-host/src/shape/format.ts:47
module
readonlymodule:string
Defined in: script-host/src/shape/format.ts:48
name
readonlyname:string
Defined in: script-host/src/shape/format.ts:49
FunctionDeclaration
Defined in: script-host/src/shape/format.ts:248
A module-level function.
Extends
ShapeCallable
Properties
arguments
readonlyarguments: readonlyShapeArgument[]
Defined in: script-host/src/shape/format.ts:159
Inherited from
ShapeCallable.arguments
kind
readonlykind:"function"
Defined in: script-host/src/shape/format.ts:249
override?
readonlyoptionaloverride?:string
Defined in: script-host/src/shape/format.ts:164
The id of the override in scripts/shape/overrides.mts that changed this entry.
Inherited from
ShapeCallable.override
privilege
readonlyprivilege: readonlyPrivilege[]
Defined in: script-host/src/shape/format.ts:158
Inherited from
ShapeCallable.privilege
returns
readonlyreturns:ShapeType
Defined in: script-host/src/shape/format.ts:250
script?
readonlyoptionalscript?:string
Defined in: script-host/src/shape/format.ts:162
raw_script_text: the TypeScript signature of a member the metadata cannot describe otherwise.
Inherited from
ShapeCallable.script
throws?
readonlyoptionalthrows?: readonlyErrorReference[]
Defined in: script-host/src/shape/format.ts:160
Inherited from
ShapeCallable.throws
GeneratorType
Defined in: script-host/src/shape/format.ts:100
A generator, as system.runJob takes one.
Properties
kind
readonlykind:"generator"
Defined in: script-host/src/shape/format.ts:101
next
readonlynext:ShapeType
Defined in: script-host/src/shape/format.ts:103
returns
readonlyreturns:ShapeType
Defined in: script-host/src/shape/format.ts:104
yield
readonlyyield:ShapeType
Defined in: script-host/src/shape/format.ts:102
InterfaceDeclaration
Defined in: script-host/src/shape/format.ts:219
An interface: a plain object shape with no value at run time.
Properties
base?
readonlyoptionalbase?:string|ExternalType
Defined in: script-host/src/shape/format.ts:221
kind
readonlykind:"interface"
Defined in: script-host/src/shape/format.ts:220
MapType
Defined in: script-host/src/shape/format.ts:79
A plain object used as a map.
Properties
key
readonlykey:ShapeType
Defined in: script-host/src/shape/format.ts:81
kind
readonlykind:"map"
Defined in: script-host/src/shape/format.ts:80
value
readonlyvalue:ShapeType
Defined in: script-host/src/shape/format.ts:82
ModuleHistory
Defined in: script-host/src/shape/format.ts:294
The generated history of one module, the content of one file in src/generated/.
Properties
declarations
readonlydeclarations:Readonly<Record<string,DeclarationHistory>>
Defined in: script-host/src/shape/format.ts:304
module
readonlymodule:string
Defined in: script-host/src/shape/format.ts:295
resolves
readonlyresolves:Readonly<Record<string,string>>
Defined in: script-host/src/shape/format.ts:303
The version BDS serves for each major version: the newest stable minor of that major, so a pack declaring 2.0.0 gets 2.10.0.
uuid
readonlyuuid:string
Defined in: script-host/src/shape/format.ts:296
versions
readonlyversions: readonlyModuleVersion[]
Defined in: script-host/src/shape/format.ts:298
Every version the file covers, oldest first. Segments refer to these.
ModuleVersion
Defined in: script-host/src/shape/format.ts:282
One published version of a module.
Properties
bindings?
readonlyoptionalbindings?:string
Defined in: script-host/src/shape/format.ts:286
The module the stub names as its parentModule, which holds the API.
dependencies
readonlydependencies:Readonly<Record<string,string>>
Defined in: script-host/src/shape/format.ts:290
The version of each module this one depends on, from peer_dependencies without types_only.
stability
readonlystability:VersionStability
Defined in: script-host/src/shape/format.ts:284
version
readonlyversion:string
Defined in: script-host/src/shape/format.ts:283
wrapper?
readonlyoptionalwrapper?:string
Defined in: script-host/src/shape/format.ts:288
The stub's wrapper_module.
ObjectDeclaration
Defined in: script-host/src/shape/format.ts:235
A module-level object, such as world, of a class in the module.
Properties
kind
readonlykind:"object"
Defined in: script-host/src/shape/format.ts:236
type
readonlytype:ShapeType
Defined in: script-host/src/shape/format.ts:237
OptionalType
Defined in: script-host/src/shape/format.ts:61
A value that may be undefined.
Properties
kind
readonlykind:"optional"
Defined in: script-host/src/shape/format.ts:62
type
readonlytype:ShapeType
Defined in: script-host/src/shape/format.ts:63
PromiseType
Defined in: script-host/src/shape/format.ts:94
A promise.
Properties
kind
readonlykind:"promise"
Defined in: script-host/src/shape/format.ts:95
type
readonlytype:ShapeType
Defined in: script-host/src/shape/format.ts:96
RangedNumberType
Defined in: script-host/src/shape/format.ts:53
A number with a valid_range other than DEFAULT_VALID_RANGE.
Properties
kind
readonlykind:"number"
Defined in: script-host/src/shape/format.ts:54
max
readonlymax:number
Defined in: script-host/src/shape/format.ts:57
min
readonlymin:number
Defined in: script-host/src/shape/format.ts:56
type
readonlytype:"int32"|"int8"|"uint8"|"int16"|"uint16"|"uint32"|"int64"|"uint64"|"float"|"double"
Defined in: script-host/src/shape/format.ts:55
ScriptTextType
Defined in: script-host/src/shape/format.ts:111
A TypeScript type the metadata spells out as text, such as BlockComponentReturnType<T> in a member with raw_script_text. Nothing validates it.
Properties
kind
readonlykind:"script"
Defined in: script-host/src/shape/format.ts:112
text
readonlytext:string
Defined in: script-host/src/shape/format.ts:113
SegmentRange
Defined in: script-host/src/shape/format.ts:264
The versions a segment covers, by version string: from to to, or to the newest when to is absent.
Properties
from
readonlyfrom:string
Defined in: script-host/src/shape/format.ts:265
to?
readonlyoptionalto?:string
Defined in: script-host/src/shape/format.ts:266
ShapeArgument
Defined in: script-host/src/shape/format.ts:140
One argument of a method, a constructor or a module function.
Properties
default?
readonlyoptionaldefault?:string|number|boolean|null
Defined in: script-host/src/shape/format.ts:147
details.default_value. Present means the argument may be left out. The metadata writes the string "null" for an argument with no default value, which the generator writes as null.
max?
readonlyoptionalmax?:number
Defined in: script-host/src/shape/format.ts:151
details.max_value.
maxLength?
readonlyoptionalmaxLength?:number
Defined in: script-host/src/shape/format.ts:153
details.max_length, for a string.
min?
readonlyoptionalmin?:number
Defined in: script-host/src/shape/format.ts:149
details.min_value.
name
readonlyname:string
Defined in: script-host/src/shape/format.ts:141
type
readonlytype:ShapeType
Defined in: script-host/src/shape/format.ts:142
ShapeConstant
Defined in: script-host/src/shape/format.ts:198
A constant of a class or an enum.
Properties
kind
readonlykind:"constant"
Defined in: script-host/src/shape/format.ts:199
static?
readonlyoptionalstatic?:true
Defined in: script-host/src/shape/format.ts:200
type
readonlytype:ShapeType
Defined in: script-host/src/shape/format.ts:201
value
readonlyvalue:string|number|boolean
Defined in: script-host/src/shape/format.ts:202
ShapeConstructor
Defined in: script-host/src/shape/format.ts:175
A class's constructor. A class without one cannot be constructed by a script.
Extends
ShapeCallable
Properties
arguments
readonlyarguments: readonlyShapeArgument[]
Defined in: script-host/src/shape/format.ts:159
Inherited from
ShapeCallable.arguments
kind
readonlykind:"constructor"
Defined in: script-host/src/shape/format.ts:176
override?
readonlyoptionaloverride?:string
Defined in: script-host/src/shape/format.ts:164
The id of the override in scripts/shape/overrides.mts that changed this entry.
Inherited from
ShapeCallable.override
privilege
readonlyprivilege: readonlyPrivilege[]
Defined in: script-host/src/shape/format.ts:158
Inherited from
ShapeCallable.privilege
script?
readonlyoptionalscript?:string
Defined in: script-host/src/shape/format.ts:162
raw_script_text: the TypeScript signature of a member the metadata cannot describe otherwise.
Inherited from
ShapeCallable.script
throws?
readonlyoptionalthrows?: readonlyErrorReference[]
Defined in: script-host/src/shape/format.ts:160
Inherited from
ShapeCallable.throws
ShapeMethod
Defined in: script-host/src/shape/format.ts:168
A method of a class, or a static one.
Extends
ShapeCallable
Properties
arguments
readonlyarguments: readonlyShapeArgument[]
Defined in: script-host/src/shape/format.ts:159
Inherited from
ShapeCallable.arguments
kind
readonlykind:"method"
Defined in: script-host/src/shape/format.ts:169
override?
readonlyoptionaloverride?:string
Defined in: script-host/src/shape/format.ts:164
The id of the override in scripts/shape/overrides.mts that changed this entry.
Inherited from
ShapeCallable.override
privilege
readonlyprivilege: readonlyPrivilege[]
Defined in: script-host/src/shape/format.ts:158
Inherited from
ShapeCallable.privilege
returns
readonlyreturns:ShapeType
Defined in: script-host/src/shape/format.ts:171
script?
readonlyoptionalscript?:string
Defined in: script-host/src/shape/format.ts:162
raw_script_text: the TypeScript signature of a member the metadata cannot describe otherwise.
Inherited from
ShapeCallable.script
static?
readonlyoptionalstatic?:true
Defined in: script-host/src/shape/format.ts:170
throws?
readonlyoptionalthrows?: readonlyErrorReference[]
Defined in: script-host/src/shape/format.ts:160
Inherited from
ShapeCallable.throws
ShapeProperty
Defined in: script-host/src/shape/format.ts:180
A property of a class, error or interface.
Properties
baked?
readonlyoptionalbaked?:true
Defined in: script-host/src/shape/format.ts:186
is_baked, which the metadata does not define.
get?
readonlyoptionalget?: readonlyPrivilege[]
Defined in: script-host/src/shape/format.ts:187
kind
readonlykind:"property"
Defined in: script-host/src/shape/format.ts:181
max?
readonlyoptionalmax?:number
Defined in: script-host/src/shape/format.ts:192
max_value: the largest number the setter accepts.
min?
readonlyoptionalmin?:number
Defined in: script-host/src/shape/format.ts:190
min_value: the smallest number the setter accepts.
override?
readonlyoptionaloverride?:string
Defined in: script-host/src/shape/format.ts:194
readOnly
readonlyreadOnly:boolean
Defined in: script-host/src/shape/format.ts:184
set?
readonlyoptionalset?: readonlyPrivilege[]
Defined in: script-host/src/shape/format.ts:188
static?
readonlyoptionalstatic?:true
Defined in: script-host/src/shape/format.ts:182
throws?
readonlyoptionalthrows?: readonlyErrorReference[]
Defined in: script-host/src/shape/format.ts:193
type
readonlytype:ShapeType
Defined in: script-host/src/shape/format.ts:183
VariantType
Defined in: script-host/src/shape/format.ts:67
A value of any one of several types.
Properties
kind
readonlykind:"variant"
Defined in: script-host/src/shape/format.ts:68
types
readonlytypes: readonlyShapeType[]
Defined in: script-host/src/shape/format.ts:69
Type Aliases
ErrorReference
ErrorReference =
string|ExternalType
Defined in: script-host/src/shape/format.ts:137
An error class a member may throw: a name in the same module, a type from another one, or Error, JavaScript's own.
NumberType
NumberType = typeof
NUMBER_TYPES[number]
Defined in: script-host/src/shape/format.ts:29
One of NUMBER_TYPES.
PrimitiveType
PrimitiveType =
NumberType| typeofOTHER_PRIMITIVE_TYPES[number]
Defined in: script-host/src/shape/format.ts:35
A type the metadata names without a declaration behind it.
Privilege
Privilege =
"default"|"restricted_execution"|"early_execution"
Defined in: script-host/src/shape/format.ts:12
An execution privilege as the metadata names it.
Segment
Segment<
Value> =SegmentRange&Value
Defined in: script-host/src/shape/format.ts:270
One stretch of versions over which a value stays the same.
Type Parameters
Value
Value
ShapeDeclaration
ShapeDeclaration =
ClassDeclaration|InterfaceDeclaration|EnumDeclaration|ErrorDeclaration|ObjectDeclaration|ConstantDeclaration|FunctionDeclaration
Defined in: script-host/src/shape/format.ts:254
A name a module declares. Interfaces are the only ones with no value at run time.
ShapeMember
ShapeMember =
ShapeMethod|ShapeConstructor|ShapeProperty|ShapeConstant
Defined in: script-host/src/shape/format.ts:206
Anything a declaration holds by name.
ShapeType
ShapeType =
string|ExternalType|RangedNumberType|OptionalType|VariantType|ArrayType|MapType|ClosureType|PromiseType|GeneratorType|ScriptTextType
Defined in: script-host/src/shape/format.ts:120
A type in the shape. A string is a PrimitiveType or the name of a class, interface or enum in the same module; isPrimitiveType tells them apart.
VersionStability
VersionStability =
"stable"|"beta"
Defined in: script-host/src/shape/format.ts:279
Whether a version is a stable release or a prerelease such as 2.11.0-beta.
Variables
DEFAULT_VALID_RANGE
constDEFAULT_VALID_RANGE:object
Defined in: script-host/src/shape/format.ts:43
The valid_range every numeric type in the pinned metadata carries, whatever its type: the int32 range. It says nothing about the type, and BDS does not enforce it on a double (section 3 of docs/research/bedrock-script-api.md), so the generator writes a range only when it differs from this one.
Type Declaration
max
readonlymax:2147483647=2147483647
min
readonlymin:-2147483648=-2147483648
NUMBER_TYPES
constNUMBER_TYPES: readonly ["int8","uint8","int16","uint16","int32","uint32","int64","uint64","float","double"]
Defined in: script-host/src/shape/format.ts:15
The numeric types the metadata uses. Every one crosses into a script as a JavaScript number.
OTHER_PRIMITIVE_TYPES
constOTHER_PRIMITIVE_TYPES: readonly ["boolean","string","undefined","void","any","unknown","error"]
Defined in: script-host/src/shape/format.ts:32
The non-numeric type names that are not a class, interface or enum of the API.
Functions
isNumberType()
isNumberType(
name): name is "int32" | "int8" | "uint8" | "int16" | "uint16" | "uint32" | "int64" | "uint64" | "float" | "double"
Defined in: script-host/src/shape/format.ts:314
Whether a type name is one of the NUMBER_TYPES.
Parameters
name
string
Returns
name is "int32" | "int8" | "uint8" | "int16" | "uint16" | "uint32" | "int64" | "uint64" | "float" | "double"
isPrimitiveType()
isPrimitiveType(
name):name is PrimitiveType
Defined in: script-host/src/shape/format.ts:311
Whether a type name is a PrimitiveType rather than a declaration of the module.
Parameters
name
string
Returns
name is PrimitiveType