Skip to content

Declaration

Create a TypeScript declaration. Generally, this component shouldn’t be used directly, and instead prefer components for specific declarations, e.g. EnumDeclaration, InterfaceDeclaration, TypeDeclaration, etc.

import { Declaration } from "@alloy-js/typescript";
<Declaration doc={Children} symbol={TSOutputSymbol} />
childrenoptional Children
docoptional ChildrenDocumentation for this declaration
symbolTSOutputSymbolThe symbol to use for this declaration.
import { Declaration } from "@alloy-js/typescript";
<Declaration
default
doc={Children}
export
kind={"type" | "value"}
metadata={Record<string, unknown>}
name={string | Namekey}
nameKind={TypeScriptElements}
refkey={Refkey | Refkey[]}
/>
childrenoptional Children
defaultoptional booleanWhether this is the default export of the module.
docoptional ChildrenDocumentation for this declaration
exportoptional booleanWhether to export this declaration from the module.
kindoptional “type” | “value”Whether this is a declaration of a type (e.g. interface, type alias) or a value (e.g. var, const, let).
metadataoptional Record<string, unknown>Arbitrary metadata about this declaration.
namestring | NamekeyThe base name of this declaration. May change depending on naming policy and any conflicts.
nameKindTypeScriptElementsThe name policy kind to apply to the declaration.
refkeyoptional Refkey | Refkey[]The refkey or array of refkeys for this declaration.

This component will wrap its contents in a Declaration component, so children can make use of declaration context.