@kubb/plugin-ts 5.0.0-beta.4 → 5.0.0-beta.56

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.
package/dist/index.d.ts CHANGED
@@ -1,6 +1,5 @@
1
- import { t as __name } from "./chunk--u3MIqq1.js";
2
- import * as _$_kubb_core0 from "@kubb/core";
3
- import { Exclude, Generator, Group, Include, Output, Override, PluginFactoryOptions, Resolver, ast } from "@kubb/core";
1
+ import { t as __name } from "./chunk-C0LytTxp.js";
2
+ import { Exclude, Generator, Group, Include, Output, OutputOptions, Override, PluginFactoryOptions, Resolver, ast } from "@kubb/core";
4
3
  import ts from "typescript";
5
4
  import { KubbReactNode } from "@kubb/renderer-jsx/types";
6
5
 
@@ -44,23 +43,11 @@ type PrinterTsOptions = {
44
43
  */
45
44
  arrayType: PluginTs['resolvedOptions']['arrayType'];
46
45
  /**
47
- * Enum output format.
48
- * - `'inlineLiteral'` embeds literal unions inline
49
- * - `'asPascalConst'` generates named const unions
50
- * - `'asConst'` generates as const declarations
51
- *
52
- * @default `'inlineLiteral'`
53
- */
54
- enumType: PluginTs['resolvedOptions']['enumType'];
55
- /**
56
- * Suffix appended to enum key reference names.
57
- *
58
- * @example Enum key naming
59
- * `StatusKey` when `enumType` is `'asConst'`
60
- *
61
- * @default `'Key'`
46
+ * Grouped enum settings. The printer emits references to enums, not the enum declarations, so only
47
+ * `type` (the output format) and `typeSuffix` (the enum key reference suffix) matter here.
48
+ * `constCasing` and `keyCasing` are ignored.
62
49
  */
63
- enumTypeSuffix?: PluginTs['resolvedOptions']['enumTypeSuffix'];
50
+ enum: PluginTs['resolvedOptions']['enum'];
64
51
  /**
65
52
  * Syntax for generated declarations.
66
53
  * - `'type'` generates type aliases
@@ -82,7 +69,7 @@ type PrinterTsOptions = {
82
69
  * Properties to exclude using `Omit<Type, Keys>`.
83
70
  * Forces type alias syntax regardless of `syntaxType` setting.
84
71
  */
85
- keysToOmit?: Array<string>;
72
+ keysToOmit?: Array<string> | null;
86
73
  /**
87
74
  * Transforms raw schema names into valid TypeScript identifiers.
88
75
  */
@@ -113,13 +100,13 @@ type PrinterTsFactory = ast.PrinterFactoryOptions<'typescript', PrinterTsOptions
113
100
  *
114
101
  * @example Raw type node (no `typeName`)
115
102
  * ```ts
116
- * const printer = printerTs({ optionalType: 'questionToken', arrayType: 'array', enumType: 'inlineLiteral' })
103
+ * const printer = printerTs({ optionalType: 'questionToken', arrayType: 'array', enum: { type: 'inlineLiteral' } })
117
104
  * const typeNode = printer.print(schemaNode) // ts.TypeNode
118
105
  * ```
119
106
  *
120
107
  * @example Full declaration (with `typeName`)
121
108
  * ```ts
122
- * const printer = printerTs({ optionalType: 'questionToken', arrayType: 'array', enumType: 'inlineLiteral', typeName: 'MyType' })
109
+ * const printer = printerTs({ optionalType: 'questionToken', arrayType: 'array', enum: { type: 'inlineLiteral' }, typeName: 'MyType' })
123
110
  * const declaration = printer.print(schemaNode) // ts.TypeAliasDeclaration | ts.InterfaceDeclaration
124
111
  * ```
125
112
  */
@@ -217,33 +204,47 @@ type ResolverTs = Resolver & ast.OperationParamsResolver & {
217
204
  resolveHeaderParamsName(node: ast.OperationNode, param: ast.ParameterNode): string;
218
205
  };
219
206
  type EnumKeyCasing = 'screamingSnakeCase' | 'snakeCase' | 'pascalCase' | 'camelCase' | 'none';
207
+ type EnumConstCasing = 'camelCase' | 'pascalCase';
220
208
  /**
221
- * Discriminated union that ties `enumTypeSuffix` and `enumKeyCasing` to the enum types that actually use them.
209
+ * Grouped enum settings. Each `type` uses only some of the other fields.
222
210
  *
223
- * - `'asConst'` / `'asPascalConst'` emit a `const` object; both `enumTypeSuffix` (type-alias suffix) and
224
- * `enumKeyCasing` (key formatting) are meaningful.
225
- * - `'enum'` / `'constEnum'` emit a TypeScript enum; `enumKeyCasing` applies to member names,
226
- * but there is no separate type alias so `enumTypeSuffix` is not used.
227
- * - `'literal'` / `'inlineLiteral'` emit only union literals; keys are discarded entirely,
228
- * so neither `enumTypeSuffix` nor `enumKeyCasing` have any effect.
211
+ * - `'asConst'` emits a `const` object plus a `typeof` type alias, so `constCasing`, `typeSuffix`, and `keyCasing` all apply.
212
+ * - `'enum'` and `'constEnum'` emit a TypeScript enum, so only `keyCasing` (the member names) applies.
213
+ * - `'literal'` and `'inlineLiteral'` emit union literals and drop the keys, so none of the other fields apply.
214
+ *
215
+ * @example Share one name between the const and the type
216
+ * ```ts
217
+ * enum: { type: 'asConst', constCasing: 'pascalCase', typeSuffix: '' }
218
+ * // export const VehicleType = { … } as const
219
+ * // export type VehicleType = (typeof VehicleType)[keyof typeof VehicleType]
220
+ * ```
229
221
  */
230
- type EnumTypeOptions = {
222
+ type EnumOptions$1 = {
231
223
  /**
232
- * Choose to use enum, asConst, asPascalConst, constEnum, literal, or inlineLiteral for enums.
233
- * - 'asConst' generates const objects with camelCase names and as const assertion.
234
- * - 'asPascalConst' generates const objects with PascalCase names and as const assertion.
224
+ * Emit a `const` object asserted with `as const`, paired with a `typeof` type alias.
225
+ * This is tree-shakeable and adds no enum runtime.
226
+ *
235
227
  * @default 'asConst'
236
228
  */
237
- enumType?: 'asConst' | 'asPascalConst';
229
+ type?: 'asConst';
238
230
  /**
239
- * Suffix appended to the generated type alias name.
231
+ * Casing of the generated const variable.
232
+ * - 'camelCase' names the const `vehicleType`.
233
+ * - 'pascalCase' names the const `VehicleType`, matching the schema name.
240
234
  *
241
- * Only affects the type alias — the const object name is unchanged.
235
+ * @default 'camelCase'
236
+ */
237
+ constCasing?: EnumConstCasing;
238
+ /**
239
+ * Suffix appended to the generated type alias name. Only the type alias is renamed. The const
240
+ * object name stays the same. Set it to `''` together with `constCasing: 'pascalCase'` to merge
241
+ * the const and type under the schema's exact name.
242
242
  *
243
243
  * @default 'Key'
244
- * @example enumTypeSuffix: 'Value' → `export type PetStatusValue = …`
244
+ * @example A custom suffix
245
+ * `typeSuffix: 'Value'` renames the alias to `PetStatusValue`
245
246
  */
246
- enumTypeSuffix?: string;
247
+ typeSuffix?: string;
247
248
  /**
248
249
  * Choose the casing for enum key names.
249
250
  * - 'screamingSnakeCase' generates keys in SCREAMING_SNAKE_CASE format.
@@ -253,22 +254,24 @@ type EnumTypeOptions = {
253
254
  * - 'none' uses the enum value as-is without transformation.
254
255
  * @default 'none'
255
256
  */
256
- enumKeyCasing?: EnumKeyCasing;
257
+ keyCasing?: EnumKeyCasing;
257
258
  } | {
258
259
  /**
259
- * Choose to use enum, asConst, asPascalConst, constEnum, literal, or inlineLiteral for enums.
260
- * - 'enum' generates TypeScript enum declarations.
261
- * - 'constEnum' generates TypeScript const enum declarations.
260
+ * Emit a TypeScript `enum` (`'enum'`) or `const enum` (`'constEnum'`) declaration.
261
+ *
262
262
  * @default 'asConst'
263
263
  */
264
- enumType?: 'enum' | 'constEnum';
264
+ type?: 'enum' | 'constEnum';
265
265
  /**
266
- * `enumTypeSuffix` has no effect for this `enumType`.
267
- * It is only used when `enumType` is `'asConst'` or `'asPascalConst'`.
266
+ * `constCasing` has no effect for this `type`. Only `'asConst'` emits a const object.
268
267
  */
269
- enumTypeSuffix?: never;
268
+ constCasing?: never;
270
269
  /**
271
- * Choose the casing for enum key names.
270
+ * `typeSuffix` has no effect for this `type`. Only `'asConst'` emits a separate type alias.
271
+ */
272
+ typeSuffix?: never;
273
+ /**
274
+ * Choose the casing for enum member names.
272
275
  * - 'screamingSnakeCase' generates keys in SCREAMING_SNAKE_CASE format.
273
276
  * - 'snakeCase' generates keys in snake_case format.
274
277
  * - 'pascalCase' generates keys in PascalCase format.
@@ -276,97 +279,99 @@ type EnumTypeOptions = {
276
279
  * - 'none' uses the enum value as-is without transformation.
277
280
  * @default 'none'
278
281
  */
279
- enumKeyCasing?: EnumKeyCasing;
282
+ keyCasing?: EnumKeyCasing;
280
283
  } | {
281
284
  /**
282
- * Choose to use enum, asConst, asPascalConst, constEnum, literal, or inlineLiteral for enums.
283
- * - 'literal' generates literal union types.
284
- * - 'inlineLiteral' will inline enum values directly into the type (default in v5).
285
+ * Emit a union of literals as a named alias (`'literal'`) or inline the union at every usage
286
+ * site (`'inlineLiteral'`).
287
+ *
285
288
  * @default 'asConst'
286
289
  * @note In Kubb v5, 'inlineLiteral' becomes the default.
287
290
  */
288
- enumType?: 'literal' | 'inlineLiteral';
289
- /**
290
- * `enumTypeSuffix` has no effect for this `enumType`.
291
- * It is only used when `enumType` is `'asConst'` or `'asPascalConst'`.
292
- */
293
- enumTypeSuffix?: never;
294
- /**
295
- * `enumKeyCasing` has no effect for this `enumType`.
296
- * Literal and inlineLiteral modes emit only values — keys are discarded entirely.
297
- */
298
- enumKeyCasing?: never;
299
- };
300
- type Options = {
291
+ type?: 'literal' | 'inlineLiteral';
301
292
  /**
302
- * Specify the export location for the files and define the behavior of the output
303
- * @default { path: 'types', barrelType: 'named' }
293
+ * `constCasing` has no effect for this `type`; literal modes emit no const object.
304
294
  */
305
- output?: Output;
295
+ constCasing?: never;
306
296
  /**
307
- * Define which contentType should be used.
308
- * By default, uses the first valid JSON media type.
297
+ * `typeSuffix` has no effect for this `type`; literal modes emit no separate type alias.
309
298
  */
310
- contentType?: 'application/json' | (string & {});
299
+ typeSuffix?: never;
311
300
  /**
312
- * Group the clients based on the provided name.
301
+ * `keyCasing` has no effect for this `type`. Literal and inlineLiteral modes emit only values,
302
+ * so the keys are discarded.
313
303
  */
314
- group?: Group;
304
+ keyCasing?: never;
305
+ };
306
+ /**
307
+ * Where the generated `.ts` files are written and how they are exported, plus the optional
308
+ * `group` strategy. The `group` option organizes `output.mode: 'directory'` output into per-tag or per-path subdirectories.
309
+ *
310
+ * @default { path: 'types', barrel: { type: 'named' } }
311
+ */
312
+ type Options = OutputOptions & {
315
313
  /**
316
- * Array containing exclude parameters to exclude/skip tags/operations/methods/paths.
314
+ * Skip operations matching at least one entry in the list.
317
315
  */
318
316
  exclude?: Array<Exclude>;
319
317
  /**
320
- * Array containing include parameters to include tags/operations/methods/paths.
318
+ * Restrict generation to operations matching at least one entry in the list.
321
319
  */
322
320
  include?: Array<Include>;
323
321
  /**
324
- * Array containing override parameters to override `options` based on tags/operations/methods/paths.
322
+ * Apply a different options object to operations matching a pattern.
325
323
  */
326
324
  override?: Array<Override<ResolvedOptions>>;
327
325
  /**
328
- * Switch between type or interface for creating TypeScript types.
329
- * - 'type' generates type alias declarations.
330
- * - 'interface' generates interface declarations.
326
+ * Whether object schemas are emitted as `type` aliases or `interface` declarations.
327
+ * - `'type'` emits closed type aliases. Safer default for generated code.
328
+ * - `'interface'` emits interfaces. Useful when consumers rely on declaration merging.
329
+ *
331
330
  * @default 'type'
331
+ * @see https://www.totaltypescript.com/type-vs-interface-which-should-you-use
332
332
  */
333
333
  syntaxType?: 'type' | 'interface';
334
334
  /**
335
- * Choose what to use as mode for an optional value.
336
- * - 'questionToken' marks the property as optional with ? (e.g., type?: string).
337
- * - 'undefined' adds undefined to the type union (e.g., type: string | undefined).
338
- * - 'questionTokenAndUndefined' combines both approaches (e.g., type?: string | undefined).
335
+ * How optional properties are written in generated types.
336
+ * - `'questionToken'` `type?: string`. The property may be missing.
337
+ * - `'undefined'` `type: string | undefined`. Required to exist, may be `undefined`.
338
+ * - `'questionTokenAndUndefined'` `type?: string | undefined`. Strictest.
339
+ *
339
340
  * @default 'questionToken'
341
+ * @note Pick `'questionTokenAndUndefined'` when `exactOptionalPropertyTypes` is on in `tsconfig.json`.
340
342
  */
341
343
  optionalType?: 'questionToken' | 'undefined' | 'questionTokenAndUndefined';
342
344
  /**
343
- * Choose between Array<string> or string[] for array types.
344
- * - 'generic' generates Array<Type> syntax.
345
- * - 'array' generates Type[] syntax.
345
+ * Syntax used for array types.
346
+ * - `'array'` `Type[]`. Shorter.
347
+ * - `'generic'` `Array<Type>`. More readable for complex element types.
348
+ *
346
349
  * @default 'array'
347
350
  */
348
351
  arrayType?: 'generic' | 'array';
349
352
  /**
350
- * How to style your params, by default no casing is applied
351
- * - 'camelcase' uses camelCase for pathParams, queryParams and headerParams property names
352
- * @default undefined
353
- * @note response types (data/body) are NOT affected by this option
353
+ * Rename properties inside `PathParams`, `QueryParams`, and `HeaderParams` types.
354
+ * Response and request body types are not affected.
355
+ *
356
+ * @note Every plugin that touches operation parameters must use the same value.
354
357
  */
355
358
  paramsCasing?: 'camelcase';
356
359
  /**
357
- * Define some generators next to the ts generators
360
+ * Custom generators that run alongside the built-in TypeScript generators.
358
361
  */
359
362
  generators?: Array<Generator<PluginTs>>;
360
363
  /**
361
- * Override naming conventions. When a method returns `null` or `undefined`, the preset
362
- * resolver (`resolverTs`) is used as fallback.
364
+ * Override how names and file paths are built for generated symbols.
365
+ * Methods you omit fall back to the default `resolverTs`. `this` is bound to the
366
+ * full resolver, so `this.default(name, 'function')` delegates to the built-in
367
+ * implementation.
363
368
  */
364
369
  resolver?: Partial<ResolverTs> & ThisType<ResolverTs>;
365
370
  /**
366
- * AST visitor applied to each schema/operation node before printing.
367
- * Returning `null` or `undefined` from a visitor method falls back to the preset transformer.
371
+ * AST visitor applied to each schema or operation node before printing.
372
+ * Methods you omit fall back to the preset transformer.
368
373
  *
369
- * @example Remove writeOnly properties from response types
374
+ * @example Drop writeOnly properties from response types
370
375
  * ```ts
371
376
  * transformer: {
372
377
  * property(node) {
@@ -377,18 +382,17 @@ type Options = {
377
382
  */
378
383
  transformer?: ast.Visitor;
379
384
  /**
380
- * Override individual printer node handlers to customize rendering of specific schema types.
381
- *
382
- * Each key is a `SchemaType` (e.g. `'date'`, `'string'`). The function replaces the
383
- * built-in handler for that type. Use `this.transform` to recurse into nested schema nodes.
385
+ * Replace the TypeScript handler for a specific schema type (`'integer'`, `'date'`, ...).
386
+ * Each handler returns a TypeScript AST node for that schema type. Use `this.transform`
387
+ * to recurse into nested schema nodes.
384
388
  *
385
- * @example Override the `date` node to use the `Date` object type
389
+ * @example Use the JavaScript `Date` object for date schemas
386
390
  * ```ts
387
391
  * import ts from 'typescript'
388
392
  * pluginTs({
389
393
  * printer: {
390
394
  * nodes: {
391
- * date(node) {
395
+ * date() {
392
396
  * return ts.factory.createTypeReferenceNode('Date', [])
393
397
  * },
394
398
  * },
@@ -399,16 +403,24 @@ type Options = {
399
403
  printer?: {
400
404
  nodes?: PrinterTsNodes;
401
405
  };
402
- } & EnumTypeOptions;
406
+ /**
407
+ * How OpenAPI enums are represented in the generated TypeScript, and how their names are cased.
408
+ */
409
+ enum?: EnumOptions$1;
410
+ };
411
+ type ResolvedEnumOptions = {
412
+ type: NonNullable<EnumOptions$1['type']>;
413
+ constCasing: EnumConstCasing;
414
+ typeSuffix: string;
415
+ keyCasing: EnumKeyCasing;
416
+ };
403
417
  type ResolvedOptions = {
404
418
  output: Output;
405
419
  exclude: Array<Exclude>;
406
420
  include: Array<Include> | undefined;
407
421
  override: Array<Override<ResolvedOptions>>;
408
- group: Group | undefined;
409
- enumType: NonNullable<Options['enumType']>;
410
- enumTypeSuffix: NonNullable<Options['enumTypeSuffix']>;
411
- enumKeyCasing: EnumKeyCasing;
422
+ group: Group | null;
423
+ enum: ResolvedEnumOptions;
412
424
  optionalType: NonNullable<Options['optionalType']>;
413
425
  arrayType: NonNullable<Options['arrayType']>;
414
426
  syntaxType: NonNullable<Options['syntaxType']>;
@@ -425,11 +437,10 @@ declare global {
425
437
  }
426
438
  //#endregion
427
439
  //#region src/components/Enum.d.ts
440
+ type EnumOptions = PluginTs['resolvedOptions']['enum'];
428
441
  type Props$1 = {
429
442
  node: ast.EnumSchemaNode;
430
- enumType: PluginTs['resolvedOptions']['enumType'];
431
- enumTypeSuffix: PluginTs['resolvedOptions']['enumTypeSuffix'];
432
- enumKeyCasing: PluginTs['resolvedOptions']['enumKeyCasing'];
443
+ enum: EnumOptions;
433
444
  resolver: ResolverTs;
434
445
  key?: string | number | null;
435
446
  };
@@ -437,14 +448,17 @@ type Props$1 = {
437
448
  * Resolves the runtime identifier name and the TypeScript type name for an enum schema node.
438
449
  *
439
450
  * The raw `node.name` may be a YAML key such as `"enumNames.Type"` which is not a
440
- * valid TypeScript identifier. The resolver normalizes it; for inline enum
441
- * properties the adapter already emits a PascalCase+suffix name so resolution is typically a no-op.
451
+ * valid TypeScript identifier. The resolver normalizes it. For inline enum properties the adapter
452
+ * already emits a PascalCase+suffix name, so resolution is typically a no-op.
453
+ *
454
+ * When `constCasing` is `'pascalCase'` and `typeSuffix` is empty, the const and the type
455
+ * resolve to the same name, which TypeScript merges into a single value+type declaration.
442
456
  */
443
457
  /**
444
458
  * Renders the enum declaration(s) for a single named `EnumSchemaNode`.
445
459
  *
446
- * Depending on `enumType` this may emit:
447
- * - A runtime object (`asConst` / `asPascalConst`) plus a `typeof` type alias
460
+ * Depending on `enum.type` this may emit:
461
+ * - A runtime object (`asConst`) plus a `typeof` type alias
448
462
  * - A `const enum` or plain `enum` declaration (`constEnum` / `enum`)
449
463
  * - A union literal type alias (`literal`)
450
464
  *
@@ -453,9 +467,7 @@ type Props$1 = {
453
467
  */
454
468
  declare function Enum({
455
469
  node,
456
- enumType,
457
- enumTypeSuffix,
458
- enumKeyCasing,
470
+ enum: enumOptions,
459
471
  resolver
460
472
  }: Props$1): KubbReactNode;
461
473
  //#endregion
@@ -468,46 +480,57 @@ type Props = {
468
480
  * Created with `printerTs({ ..., nodes: options.printer?.nodes })`.
469
481
  */
470
482
  printer: ast.Printer<PrinterTsFactory>;
471
- enumType: PluginTs['resolvedOptions']['enumType'];
472
- enumTypeSuffix: PluginTs['resolvedOptions']['enumTypeSuffix'];
473
- enumKeyCasing: PluginTs['resolvedOptions']['enumKeyCasing'];
483
+ enum: PluginTs['resolvedOptions']['enum'];
474
484
  resolver: ResolverTs;
475
485
  };
476
486
  declare function Type({
477
487
  name,
478
488
  node,
479
489
  printer,
480
- enumType,
481
- enumTypeSuffix,
482
- enumKeyCasing,
490
+ enum: enumOptions,
483
491
  resolver
484
492
  }: Props): KubbReactNode;
485
493
  //#endregion
486
494
  //#region src/generators/typeGenerator.d.ts
487
- declare const typeGenerator: _$_kubb_core0.Generator<PluginTs, unknown>;
495
+ /**
496
+ * Built-in generator for `@kubb/plugin-ts`. Emits one TypeScript file per
497
+ * schema in the spec plus per-operation request, response, and parameter
498
+ * types. Drop-replace with a custom `Generator<PluginTs>` to change how
499
+ * TypeScript output is produced.
500
+ */
501
+ declare const typeGenerator: import("@kubb/core").Generator<PluginTs, unknown>;
488
502
  //#endregion
489
503
  //#region src/plugin.d.ts
490
504
  /**
491
- * Canonical plugin name for `@kubb/plugin-ts`, used to identify the plugin in driver lookups and warnings.
505
+ * Canonical plugin name for `@kubb/plugin-ts`. Used for driver lookups and
506
+ * cross-plugin dependency references.
492
507
  */
493
508
  declare const pluginTsName = "plugin-ts";
494
509
  /**
495
- * The `@kubb/plugin-ts` plugin factory.
496
- *
497
- * Generates TypeScript type declarations from an OpenAPI/AST `RootNode`.
498
- * Walks schemas and operations, delegates rendering to the active generators,
499
- * and writes barrel files based on `output.barrelType`.
510
+ * Generates TypeScript `type` aliases and `interface` declarations from an
511
+ * OpenAPI spec. The foundation that every other Kubb plugin builds on:
512
+ * clients, query hooks, mocks, and validators all reference the names this
513
+ * plugin produces.
500
514
  *
501
515
  * @example
502
516
  * ```ts
503
- * import pluginTs from '@kubb/plugin-ts'
517
+ * import { defineConfig } from 'kubb'
518
+ * import { pluginTs } from '@kubb/plugin-ts'
504
519
  *
505
520
  * export default defineConfig({
506
- * plugins: [pluginTs({ output: { path: 'types' }, enumType: 'asConst' })],
521
+ * input: { path: './petStore.yaml' },
522
+ * output: { path: './src/gen' },
523
+ * plugins: [
524
+ * pluginTs({
525
+ * output: { path: './types' },
526
+ * enum: { type: 'asConst' },
527
+ * optionalType: 'questionTokenAndUndefined',
528
+ * }),
529
+ * ],
507
530
  * })
508
531
  * ```
509
532
  */
510
- declare const pluginTs: (options?: Options | undefined) => _$_kubb_core0.Plugin<PluginTs>;
533
+ declare const pluginTs: (options?: Options | undefined) => import("@kubb/core").Plugin<PluginTs>;
511
534
  //#endregion
512
535
  //#region src/printers/functionPrinter.d.ts
513
536
  type FunctionPrinterOptions = {
@@ -552,26 +575,27 @@ type FunctionPrinterOptions = {
552
575
  declare const functionPrinter: (options?: FunctionPrinterOptions | undefined) => {
553
576
  name: "functionParameters";
554
577
  options: FunctionPrinterOptions;
555
- transform: (node: ast.FunctionParamNode) => string | null | undefined;
556
- print: (node: ast.FunctionParamNode) => string | null | undefined;
578
+ transform: (node: ast.FunctionParamNode) => string | null;
579
+ print: (node: ast.FunctionParamNode) => string | null;
557
580
  };
558
581
  //#endregion
559
582
  //#region src/resolvers/resolverTs.d.ts
560
583
  /**
561
- * Resolver for `@kubb/plugin-ts` that provides the default naming and path-resolution
562
- * helpers used by the plugin. Import this in other plugins to resolve the exact names and
563
- * paths that `plugin-ts` generates without hardcoding the conventions.
584
+ * Default resolver used by `@kubb/plugin-ts`. Decides the names and file paths
585
+ * for every generated TypeScript type. Import this in other plugins that need
586
+ * to reference the exact names `plugin-ts` produces without duplicating the
587
+ * casing/file-layout rules.
564
588
  *
565
- * The `default` method is automatically injected by `defineResolver` it uses `camelCase`
566
- * for identifiers/files and `pascalCase` for type names.
589
+ * The `default` method is supplied by `defineResolver`. It uses PascalCase for
590
+ * type names and PascalCase file paths (dotted names become `/`-joined) for files.
567
591
  *
568
- * @example
592
+ * @example Resolve a type and file name
569
593
  * ```ts
570
- * import { resolver } from '@kubb/plugin-ts'
594
+ * import { resolverTs } from '@kubb/plugin-ts'
571
595
  *
572
- * resolver.default('list pets', 'type') // 'ListPets'
573
- * resolver.resolveName('list pets status 200') // 'ListPetsStatus200'
574
- * resolver.resolvePathName('list pets', 'file') // 'listPets'
596
+ * resolverTs.default('list pets', 'type') // 'ListPets'
597
+ * resolverTs.resolvePathName('list pets', 'file') // 'ListPets'
598
+ * resolverTs.resolveResponseStatusName(node, 200) // 'ListPetsStatus200'
575
599
  * ```
576
600
  */
577
601
  declare const resolverTs: ResolverTs;