InterfaceDeclaration
Go interface declaration.
Properties for creating an interface declaration.
This can be used for both named and anonymous interfaces.
For named interfaces, use InterfaceTypeDeclarationProps instead.
import { InterfaceDeclaration } from "@alloy-js/go";
<InterfaceDeclaration refkey={Refkey} singleLine> {children}</InterfaceDeclaration>import { InterfaceDeclaration } from "@alloy-js/go/stc";
InterfaceDeclaration({ refkey: Refkey, singleLine: boolean,}).children(children)| children | optional Children | |
| refkey | optional Refkey | |
| singleLine | optional boolean | Whether to render the interface 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. |
Example
Section titled “Example”<InterfaceDeclaration>
<InterfaceEmbed>{MyOtherInterface}</InterfaceEmbed>
<InterfaceFunction name="MyFunc" parameters={params} returns="int" />
</InterfaceDeclaration>
This will produce:
interface {
MyOtherInterface
func MyFunc(param Param) int
}