MemberScope
Declare a member scope, which is a lexical scope whose symbols are provided by the owner symbol.
Overload 1
Section titled “Overload 1”Declare a member scope by providing an already created scope. The scope is exposed via Scope context.
import { MemberScope } from "@alloy-js/core";
<MemberScope value={OutputScope}> {children}</MemberScope>import { MemberScope } from "@alloy-js/core/stc";
MemberScope({ value: OutputScope }).children(children)| children | optional Children | |
| value | OutputScope | The scope to use. If not provided, a new scope will be created. |
Overload 2
Section titled “Overload 2”Create a member scope by providing a name and optional metadata.
import { MemberScope } from "@alloy-js/core";
<MemberScope metadata={Record<string, unknown>} name="string" ownerSymbol={OutputSymbol}> {children}</MemberScope>import { MemberScope } from "@alloy-js/core/stc";
MemberScope({ metadata: Record<string, unknown>, name: string, ownerSymbol: OutputSymbol,}).children(children)| children | optional Children | |
| metadata | optional Record<string, unknown> | Additional metadata for the scope. |
| name | optional string | The name of this scope. |
| ownerSymbol | OutputSymbol | The symbol whose members provide the symbols for this scope. |
Remarks
Section titled “Remarks”This is used to create members of a symbol, e.g. for class members and the like. In some languages, this scope may provide symbols which are can be referenced lexically, but in other languages, these members may not be in scope and instead must be referenced via the owner symbol itself.
When called with name (without value), this delegates to <Scope> which
creates a BasicScope. The same restriction applies: the parent scope must
be a BasicScope. For custom scope types, create your scope and pass it via
the value prop.