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.

Overload 1

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

Props

childrenoptionalChildren
childrenoptionalChildren

The block’s contents

closeroptionalstring

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

newlineoptionalboolean

Whether the block starts on a new line. When true, a hardline is added prior to the block.

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.

Overload 2

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

Props

childrenoptionalChildren
childrenoptionalChildren

The block’s contents

closeroptionalstring

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

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.

openeroptionalstring

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