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
Section titled “Overload 1”import { BlockScope } from "@alloy-js/typescript";
<BlockScope closer="string" inline newline opener="string" value={OutputScope} />import { BlockScope } from "@alloy-js/typescript/stc";
BlockScope({ closer: string, inline: boolean, newline: boolean, opener: string, value: OutputScope,}).children(children)| children | optionalChildren |
| children | optionalChildrenThe block’s contents |
| closer | optionalstringThe closing punctuation of the block. Defaults to ”}“. |
| inline | optionalbooleanIf true the block will not indent the content into new lines |
| newline | optionalbooleanWhether the block starts on a new line. When true, a hardline is added
prior to the block. If |
| opener | optionalstringThe opening punctuation of the block. Defaults to ”{“. |
| value | Scope context interfaceThe scope to use. If not provided, a new scope will be created. |
Overload 2
Section titled “Overload 2”import { BlockScope } from "@alloy-js/typescript";
<BlockScope closer="string" inline metadata={Record<string, unknown>} name="string" newline opener="string" ownerSymbol={OutputSymbol} />import { BlockScope } from "@alloy-js/typescript/stc";
BlockScope({ closer: string, inline: boolean, metadata: Record<string, unknown>, name: string, newline: boolean, opener: string, ownerSymbol: OutputSymbol,}).children(children)| children | optionalChildren |
| children | optionalChildrenThe block’s contents |
| closer | optionalstringThe closing punctuation of the block. Defaults to ”}“. |
| inline | optionalbooleanIf true the block will not indent the content into new lines |
| metadata | optionalRecord<string, unknown>Additional metadata for the scope. |
| name | optionalstringThe name of this scope. |
| newline | optionalbooleanWhether the block starts on a new line. When true, a hardline is added
prior to the block. If |
| opener | optionalstringThe opening punctuation of the block. Defaults to ”{“. |
| ownerSymbol | optionalMemberDeclaration context interfaceCreate a member scope with the owner symbol providing the in-scope symbols. |