Skip to content

FunctionDeclaration

import { FunctionDeclaration } from "@alloy-js/go";
<FunctionDeclaration
doc={Children}
name={string | Namekey}
parameters={FunctionParameterProps[]}
receiver={Children}
refkey={Refkey}
returns={Children}
singleLine
typeParameters={TypeParameterProps[]}
>
{children}
</FunctionDeclaration>
childrenoptional Children
docoptional ChildrenDoc comment
namestring | Namekey
parametersoptional FunctionParameterProps[]
receiveroptional ChildrenGo receiver (for methods)
refkeyoptional Refkey
returnsoptional Children
singleLineoptional booleanWhether to render the function in a single line. This will only compile if children is a single line as well. This is not common in Go, so use with caution.
typeParametersoptional TypeParameterProps[]Type parameters for generic functions