# Declaration

Create a TypeScript declaration. Generally, this component shouldn’t be used directly, and instead prefer components for specific declarations, e.g. [EnumDeclaration](../enumdeclaration/), [InterfaceDeclaration](../interfacedeclaration/), [TypeDeclaration](../../variables/typedeclaration/), etc.

## Overload 1

* jsx

  ```tsx
  import { Declaration } from "@alloy-js/typescript";


  <Declaration doc={Children} symbol={TSOutputSymbol} />
  ```

* stc

  ```ts
  import { Declaration } from "@alloy-js/typescript/stc";


  Declaration({ doc: Children, symbol: TSOutputSymbol }).children(children)
  ```

### Props

|          |                                                   |                                         |
| -------- | ------------------------------------------------- | --------------------------------------- |
| children | optional[Children](../../../core/types/children/) |                                         |
| doc      | optional[Children](../../../core/types/children/) | Documentation for this declaration      |
| symbol   | [TSOutputSymbol](../../types/tsoutputsymbol/)     | The symbol to use for this declaration. |

## Overload 2

* jsx

  ```tsx
  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[]}
   />
  ```

* stc

  ```ts
  import { Declaration } from "@alloy-js/typescript/stc";


  Declaration({
    default: boolean,
    doc: Children,
    export: boolean,
    kind: "type" | "value",
    metadata: Record<string, unknown>,
    name: string | Namekey,
    nameKind: TypeScriptElements,
    refkey: Refkey | Refkey[],
  }).children(children)
  ```

### Props

|          |                                                                                           |                                                                                                         |
| -------- | ----------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- |
| children | optional[Children](../../../core/types/children/)                                         |                                                                                                         |
| default  | optional boolean                                                                          | Whether this is the default export of the module.                                                       |
| doc      | optional[Children](../../../core/types/children/)                                         | Documentation for this declaration                                                                      |
| export   | optional boolean                                                                          | Whether to export this declaration from the module.                                                     |
| kind     | optional “type” \| “value”                                                                | Whether this is a declaration of a type (e.g. interface, type alias) or a value (e.g. var, const, let). |
| metadata | optional Record\<string, unknown>                                                         | Arbitrary metadata about this declaration.                                                              |
| name     | string \| [Namekey](../../../core/types/namekey/)                                         | The base name of this declaration. May change depending on naming policy and any conflicts.             |
| nameKind | [TypeScriptElements](../../types/typescriptelements/)                                     | The name policy kind to apply to the declaration.                                                       |
| refkey   | optional[Refkey](../../../core/types/refkey/) \| [Refkey](../../../core/types/refkey/)\[] | The refkey or array of refkeys for this declaration.                                                    |

## Remarks

This component will wrap its contents in a [Declaration](../../../core/components/declaration/) component, so children can make use of declaration context.
