Skip to content

OutputScope

A container of symbols accessible within some scope in your output code.

__v_skipboolean
[inspect.custom]() => string
constructor(name: string, parentScope: OutputScope | undefined, options: OutputScopeOptions)Subclasses must forward all three positional arguments to super. See createScope for the preferred instantiation path.
binderBinder | undefinedThe binder that created this scope.
childrenSet<OutputScope>The scopes nested within this scope.
debugInfoRecord<string, unknown>
declarationSpacesReadonly<string[]>The declaration space keys for this scope type. Subclasses override this to declare which declaration spaces are created on construction (e.g., ["types", "values"]).
idnumberThe unique id of this scope.
isMemberScopebooleanCheck if this is scope is a member scope. Member scopes have no member spaces of their own, but instead put members of their owner symbol in scope.
isTransientbooleanWhether this scope is a transient scope. Transient scopes are used for temporary values that are to be combined with other non-transient symbols. Scopes are transient when their owner symbol is transient.
metadataRecord<string, unknown>Arbitrary metadata associated with this scope. This property is not reactive but the metadata object is a reactive object.
namestringThe name of the scope.
ownerSymbolOutputSymbol | undefinedThe symbol whose members are in scope. When an owner symbol is present, this scope is considered a member scope, and does not provide its own declaration spaces.
parentOutputScope | undefinedThe parent scope of this scope. Undefined if this is a root scope.
spaceFor(key: string) => OutputSpace | undefinedGet the declaration space for the given key (e.g., "types", "values"). Returns undefined when no space with that key exists on this scope.
spacesOutputDeclarationSpace[]Get all the declaration spaces in this scope.
toString() => string

Scopes form a tree. All scopes except the global scope have a parent scope identified by parent. Scopes can have nested scopes which can be accessed using the children property. Whether a child scope can be accessed from the parent scope is determined by each language’s scoping rules.

This interface is the base implementation of scope. Generally, most languages will have subtypes of this interface that provide additional metadata about the scope. For example, TypeScript scopes need to track whether the scope represents a package, module, class, function, etc.

Scopes are reactive values, which allows you to observe changes to the scope within a reactive context.