# InterfaceMethod

An interface method declaration.

Props for \[unresolved link] component

* jsx

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


  <InterfaceMethod
    async
    doc={Children}
    name={string | Namekey}
    parameters={ParameterDescriptor[] | string[]}
    parametersChildren={Children}
    refkey={Refkey | Refkey[]}
    returnType={Children}
    typeParameters={TypeParameterDescriptor[] | string[]}
    typeParametersChildren={Children}
  >
    {children}
  </InterfaceMethod>
  ```

* stc

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


  InterfaceMethod({
    async: boolean,
    doc: Children,
    name: string | Namekey,
    parameters: ParameterDescriptor[] | string[],
    parametersChildren: Children,
    refkey: Refkey | Refkey[],
    returnType: Children,
    typeParameters: TypeParameterDescriptor[] | string[],
    typeParametersChildren: Children,
  }).children(children)
  ```

## Props

|                        |                                                                                           |                                                                                                                                                                                                                                       |
| ---------------------- | ----------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| async                  | optional boolean                                                                          | If the method is async. It will change the returnType from `T` to `Promise<T>`                                                                                                                                                        |
| children               | optional[Children](../../../core/types/children/)                                         | Jsx content                                                                                                                                                                                                                           |
| doc                    | optional[Children](../../../core/types/children/)                                         | Documentation for this method.                                                                                                                                                                                                        |
| name                   | string \| [Namekey](../../../core/types/namekey/)                                         | Interface member name                                                                                                                                                                                                                 |
| parameters             | optional[ParameterDescriptor](../../types/parameterdescriptor/)\[] \| string\[]           | The parameters to the function. Can be an array of strings for parameters which don’t have a type or a default value. Otherwise, it’s an array of [ParameterDescriptor](../../types/parameterdescriptor/)s.                           |
| parametersChildren     | optional[Children](../../../core/types/children/)                                         | Raw content to be used as the parameter list.                                                                                                                                                                                         |
| refkey                 | optional[Refkey](../../../core/types/refkey/) \| [Refkey](../../../core/types/refkey/)\[] | Ref key for the member declaration                                                                                                                                                                                                    |
| returnType             | optional[Children](../../../core/types/children/)                                         | The return type of the function.                                                                                                                                                                                                      |
| typeParameters         | optional[TypeParameterDescriptor](../../types/typeparameterdescriptor/)\[] \| string\[]   | The type parameters for the function. Can be an array of strings for type parameters which don’t have any constraints or a default type, otherwise it’s an array of [TypeParameterDescriptor](../../types/typeparameterdescriptor/)s. |
| typeParametersChildren | optional[Children](../../../core/types/children/)                                         | Raw content to be used as the type parameter list.                                                                                                                                                                                    |

## Remarks

Providing parameters and type parameters can be accomplished in one of three ways:

1. As an array of [TypeParameterDescriptor](../../types/typeparameterdescriptor/)s or [TypeParameterDescriptor](../../types/typeparameterdescriptor/)s. 2. As raw content via the `parametersChildren` or `typeParametersChildren` props. 3. As a child of this component via the \[unresolved link] or \[unresolved link] components.

## Example

```ts
(foo: string, bar: number) => void
```
