MCPcopy
hub / github.com/prisma/prisma / NamespaceDeclaration

Class NamespaceDeclaration

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

Source from the content-addressed store, hash-verified

5
6export type NamespaceItem = AnyDeclarationBuilder | Export<AnyDeclarationBuilder>
7export 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
27export function namespace(name: string): NamespaceDeclaration {
28 return new NamespaceDeclaration(name)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected