Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

next
ts 25 lines 773 Bytes
Raw
1 import type { AnyDeclarationBuilder } from './AnyDeclarationBuilder';
2 import type { BasicBuilder } from './BasicBuilder';
3 import { DocComment } from './DocComment';
4 import { Writer } from './Writer';
5
6 export class Export<Decl extends AnyDeclarationBuilder> implements BasicBuilder {
7 private docComment?: DocComment;
8 constructor(public readonly declaration: Decl) {}
9
10 setDocComment(docComment: DocComment): this {
11 this.docComment = docComment;
12 return this;
13 }
14
15 write(writer: Writer): void {
16 if (this.docComment) {
17 writer.write(this.docComment);
18 }
19 writer.write('export ').write(this.declaration);
20 }
21 }
22
23 export function moduleExport<Decl extends AnyDeclarationBuilder>(declaration: Decl): Export<Decl> {
24 return new Export(declaration);
25 }