| 5 | |
| 6 | export type NamespaceItem = AnyDeclarationBuilder | Export<AnyDeclarationBuilder> |
| 7 | export class NamespaceDeclaration implements BasicBuilder { |
| 8 | private items: NamespaceItem[] = [] |
| 9 | constructor(readonly name: string) {} |
| 10 | |
| 11 | add(declaration: NamespaceItem) { |
| 12 | this.items.push(declaration) |
| 13 | } |
| 14 | |
| 15 | write(writer: Writer<undefined>): void { |
| 16 | writer |
| 17 | .writeLine(`namespace ${this.name} {`) |
| 18 | .withIndent(() => { |
| 19 | for (const item of this.items) { |
| 20 | writer.writeLine(item) |
| 21 | } |
| 22 | }) |
| 23 | .write('}') |
| 24 | } |
| 25 | } |
| 26 | |
| 27 | export function namespace(name: string): NamespaceDeclaration { |
| 28 | return new NamespaceDeclaration(name) |
nothing calls this directly
no outgoing calls
no test coverage detected