Skip to content

BlockScope

Create a TypeScript block which includes a scope for any nested declarations. Can either provide the scope directly via the value prop, or else provide information about the scope.

import { BlockScope } from "@alloy-js/typescript";
<BlockScope
closer="string"
inline
newline
opener="string"
value={OutputScope}
/>
childrenoptionalChildren
childrenoptionalChildren

The block’s contents

closeroptionalstring

The closing punctuation of the block. Defaults to ”}“.

inlineoptionalboolean

If true the block will not indent the content into new lines

newlineoptionalboolean

Whether the block starts on a new line. When true, a hardline is added prior to the block. If inline is true, this will only apply if the block is also split due to breaking.

openeroptionalstring

The opening punctuation of the block. Defaults to ”{“.

valueScope context interface

The scope to use. If not provided, a new scope will be created.

import { BlockScope } from "@alloy-js/typescript";
<BlockScope
closer="string"
inline
kind="string"
metadata={Record<string, unknown>}
name="string"
newline
opener="string"
/>
childrenoptionalChildren
childrenoptionalChildren

The block’s contents

closeroptionalstring

The closing punctuation of the block. Defaults to ”}“.

inlineoptionalboolean

If true the block will not indent the content into new lines

kindoptionalstring

The kind of scope. This may be used by application code to determine how to handle symbols in this scope. It is not used by the core framework.

metadataoptionalRecord<string, unknown>

Additional metadata for the scope.

nameoptionalstring

The name of this scope.

newlineoptionalboolean

Whether the block starts on a new line. When true, a hardline is added prior to the block. If inline is true, this will only apply if the block is also split due to breaking.

openeroptionalstring

The opening punctuation of the block. Defaults to ”{”.