@kubb/ast 5.0.0-alpha.17 → 5.0.0-alpha.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -184,11 +184,11 @@ export function createPrinterFactory<TNode, TKey extends string, TNodeByKey exte
184
184
  options: resolvedOptions,
185
185
  print: (node: TNode): T['output'] | null | undefined => {
186
186
  const key = getKey(node)
187
- if (key === undefined) return undefined
187
+ if (key === undefined) return null
188
188
 
189
189
  const handler = nodes[key]
190
190
 
191
- if (!handler) return undefined
191
+ if (!handler) return null
192
192
 
193
193
  return (handler as (this: typeof context, node: TNode) => T['output'] | null | undefined).call(context, node)
194
194
  },
package/src/resolvers.ts CHANGED
@@ -4,16 +4,16 @@ import type { SchemaNode } from './nodes/schema.ts'
4
4
  import { extractRefName } from './refs.ts'
5
5
  import { collect } from './visitor.ts'
6
6
 
7
- export function findDiscriminator(mapping: Record<string, string> | undefined, ref: string | undefined): string | undefined {
8
- if (!mapping || !ref) return undefined
9
- return Object.entries(mapping).find(([, value]) => value === ref)?.[0]
7
+ export function findDiscriminator(mapping: Record<string, string> | undefined, ref: string | undefined): string | null {
8
+ if (!mapping || !ref) return null
9
+ return Object.entries(mapping).find(([, value]) => value === ref)?.[0] ?? null
10
10
  }
11
11
 
12
- export function childName(parentName: string | undefined, propName: string): string | undefined {
13
- return parentName ? pascalCase([parentName, propName].join(' ')) : undefined
12
+ export function childName(parentName: string | null | undefined, propName: string): string | null {
13
+ return parentName ? pascalCase([parentName, propName].join(' ')) : null
14
14
  }
15
15
 
16
- export function enumPropName(parentName: string | undefined, propName: string, enumSuffix: string): string {
16
+ export function enumPropName(parentName: string | null | undefined, propName: string, enumSuffix: string): string {
17
17
  return pascalCase([parentName, propName, enumSuffix].filter(Boolean).join(' '))
18
18
  }
19
19
 
@@ -144,7 +144,7 @@ export function simplifyUnion(members: Array<SchemaNode>): Array<SchemaNode> {
144
144
  })
145
145
  }
146
146
 
147
- export function setEnumName(propNode: SchemaNode, parentName: string | undefined, propName: string, enumSuffix: string): SchemaNode {
147
+ export function setEnumName(propNode: SchemaNode, parentName: string | null | undefined, propName: string, enumSuffix: string): SchemaNode {
148
148
  const enumNode = narrowSchema(propNode, 'enum')
149
149
 
150
150
  if (enumNode?.primitive === 'boolean') {