@kubb/plugin-faker 5.0.11 → 5.0.12

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
@@ -203,10 +203,6 @@ type PrinterFakerOptions = {
203
203
  * Set while printing the members of a union (`oneOf`). Object properties then index their
204
204
  * type as `(NonNullable<T> & Record<K, unknown>)[K]` instead of `NonNullable<T>[K]`, so a key
205
205
  * carried by only some branches stays valid (a plain index would be a TS2339).
206
- *
207
- * Referenced object factories also receive their explicit default type argument (`object`).
208
- * This prevents a surrounding generic helper from inferring `TData` as `Partial<T>` when the
209
- * factory is called without override data, which would make required properties optional.
210
206
  */
211
207
  nestedInUnion?: boolean;
212
208
  nodes?: PrinterFakerNodes;
package/dist/index.js CHANGED
@@ -621,13 +621,13 @@ function Faker({ node, description, name, typeName, printer, canOverride }) {
621
621
  Object.defineProperty(defaultFakeData, key, { value, configurable: true, writable: true, enumerable: true })
622
622
  }
623
623
  }
624
- return defaultFakeData as Omit<typeof defaultFakeData, keyof TData> & TData
624
+ return defaultFakeData as Omit<typeof defaultFakeData, keyof NoInfer<TData>> & NoInfer<TData>
625
625
  }` : `{
626
626
  const defaultFakeData = ${fakerText}
627
627
  return {
628
628
  ...defaultFakeData,
629
629
  ...(data || {}),
630
- } as Omit<typeof defaultFakeData, keyof TData> & TData
630
+ } as Omit<typeof defaultFakeData, keyof NoInfer<TData>> & NoInfer<TData>
631
631
  }`;
632
632
  return /* @__PURE__ */ jsxs(File.Source, {
633
633
  name,
@@ -1068,7 +1068,7 @@ const printerFaker = ast.createPrinter((options) => {
1068
1068
  if (this.options.schemaName && refName === this.options.schemaName) return this.options.typeName ? `undefined as unknown as ${this.options.typeName}` : "undefined as unknown";
1069
1069
  const resolvedName = node.ref ? this.options.resolver.name(refName) : refName;
1070
1070
  if (!this.options.nestedInObject) return `${resolvedName}(data)`;
1071
- return `${resolvedName}${this.options.nestedInUnion && (node.schema?.type === "object" || node.schema?.type === "intersection") ? "<object>" : ""}()`;
1071
+ return `${resolvedName}()`;
1072
1072
  },
1073
1073
  enum(node) {
1074
1074
  return fakerKeywordMapper.enum(ast.getSchemaLiteralValues(node).map(parseEnumValue), this.options.typeName);