UNPKG

612 BPlain TextView Raw
1import type { Config } from './generateCode.js'
2
3export const title = (title: string) => {
4 const titleDecorated = `// ${title}\n// ${`-`.repeat(title.length)}\n`
5 return titleDecorated
6}
7export const typeTitle = (config: Config, typeName: string) => {
8 // @ts-expect-error ignoreme
9 // eslint-disable-next-line
10 const hasItems = config.typeMapByKind[`GraphQL${typeName}Type`]?.length > 0
11 const title = `${typeName} Types`
12 const titleDecorated = `// ${title}\n// ${`-`.repeat(title.length)}\n`
13 if (hasItems) {
14 return titleDecorated
15 } else {
16 return `${titleDecorated}\n// -- None --\n`
17 }
18}