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} />
import { BlockScope } from "@alloy-js/typescript/stc";
BlockScope({ closer: string, newline: boolean, opener: string, value: OutputScope,}).children(children)
Props
children | optionalChildren |
children | optionalChildren The block’s contents |
closer | optionalstring The closing punctuation of the block. Defaults to ”}“. |
newline | optionalboolean Whether the block starts on a new line. When true, a hardline is added prior to the block. |
opener | optionalstring The opening punctuation of the block. Defaults to ”{“. |
value | Scope 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" />
import { BlockScope } from "@alloy-js/typescript/stc";
BlockScope({ closer: string, kind: string, metadata: Record<string, unknown>, name: string, newline: boolean, opener: string,}).children(children)
Props
children | optionalChildren |
children | optionalChildren The block’s contents |
closer | optionalstring The closing punctuation of the block. Defaults to ”}“. |
kind | optionalstring 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. |
metadata | optionalRecord<string, unknown> Additional metadata for the scope. |
name | optionalstring The name of this scope. |
newline | optionalboolean Whether the block starts on a new line. When true, a hardline is added prior to the block. |
opener | optionalstring The opening punctuation of the block. Defaults to ”{”. |