Declaration
Declares a symbol in the current scope for this component’s children.
Overload 1
Section titled “Overload 1”Create a declaration by providing an already created symbol. The symbol is merely exposed via Declaration context.
import { Declaration } from "@alloy-js/core";
<Declaration symbol={OutputSymbol}> {children}</Declaration>import { Declaration } from "@alloy-js/core/stc";
Declaration({ symbol: OutputSymbol }).children(children)| children | optionalChildren |
| symbol | MemberDeclaration context interfaceThe symbol being declared. When provided, the name, refkey, and metadata props are ignored. |
Overload 2
Section titled “Overload 2”Create a declaration by providing a symbol name and optional symbol metadata.
import { Declaration } from "@alloy-js/core";
<Declaration metadata={Record<string, unknown>} name={string | Namekey} refkey={Refkey | Refkey[]}> {children}</Declaration>import { Declaration } from "@alloy-js/core/stc";
Declaration({ metadata: Record<string, unknown>, name: string | Namekey, refkey: Refkey | Refkey[],}).children(children)| children | optionalChildren |
| metadata | optionalRecord<string, unknown>Additional metadata for the declared symbol. |
| name | string | NamekeyThe name of this declaration. |
| refkey | optionalRefkey | Refkey[]The unique key or array of unique keys for this declaration. |
Remarks
Section titled “Remarks”This component must be called in one of two ways: with a name and an optional refkey, or else passing in the symbol. When called with a name and refkey, a symbol will be created in the current scope (provided by Scope context) with that name and refkey.
When called with a symbol, that symbol is merely exposed via
Declaration context. It is assumed that the caller of this component
has created the symbol with the createSymbol API on the
Binder context.