MCPcopy
hub / github.com/ComposioHQ/composio / ConstDeclaration

Class ConstDeclaration

ts/packages/ts-builders/src/ConstDeclaration.ts:7–38  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5import { Writer } from './Writer';
6
7export class ConstDeclaration implements BasicBuilder {
8 private docComment?: DocComment;
9 private value?: ValueBuilder;
10
11 constructor(
12 readonly name: string,
13 readonly type?: TypeBuilder
14 ) {}
15
16 setDocComment(docComment: DocComment): this {
17 this.docComment = docComment;
18 return this;
19 }
20
21 setValue(value: ValueBuilder): this {
22 this.value = value;
23 return this;
24 }
25
26 write(writer: Writer): void {
27 if (this.docComment) {
28 writer.write(this.docComment);
29 }
30 writer.write('const ').write(this.name);
31 if (this.type) {
32 writer.write(': ').write(this.type);
33 }
34 if (this.value) {
35 writer.write(' = ').write(this.value);
36 }
37 }
38}
39
40export function constDeclaration(name: string, type?: TypeBuilder) {
41 return new ConstDeclaration(name, type);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…