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}
/>
childrenoptional Children
childrenoptional ChildrenThe block’s contents
closeroptional stringThe closing punctuation of the block. Defaults to ”}“.
inlineoptional booleanIf true the block will not indent the content into new lines
newlineoptional booleanWhether 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.
openeroptional stringThe opening punctuation of the block. Defaults to ”{“.
valueOutputScopeThe scope to use. If not provided, a new scope will be created.
import { BlockScope } from "@alloy-js/typescript";
<BlockScope
closer="string"
inline
metadata={Record<string, unknown>}
name="string"
newline
opener="string"
ownerSymbol={OutputSymbol}
/>
childrenoptional Children
childrenoptional ChildrenThe block’s contents
closeroptional stringThe closing punctuation of the block. Defaults to ”}“.
inlineoptional booleanIf true the block will not indent the content into new lines
metadataoptional Record<string, unknown>Additional metadata for the scope.
nameoptional stringThe name of this scope.
newlineoptional booleanWhether 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.
openeroptional stringThe opening punctuation of the block. Defaults to ”{“.
ownerSymboloptional OutputSymbolCreate a member scope with the owner symbol providing the in-scope symbols.