Skip to content

MemberScope

Declare a member scope, which is a lexical scope whose symbols are provided by the owner symbol.

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>
childrenoptional Children
valueOutputScopeThe scope to use. If not provided, a new scope will be created.

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>
childrenoptional Children
metadataoptional Record<string, unknown>Additional metadata for the scope.
nameoptional stringThe name of this scope.
ownerSymbolOutputSymbolThe symbol whose members provide the symbols for this scope.

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.