@kubb/plugin-faker 5.0.1 → 5.0.2

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.cjs CHANGED
@@ -348,7 +348,7 @@ function filterUsedImports(imports, text, skipImportNames = []) {
348
348
  return imports.filter((entry) => {
349
349
  return getImportNames(entry).some((name) => {
350
350
  if (skip.has(name)) return false;
351
- return new RegExp(`\\b${escapeRegExp(name)}\\b(?=\\s*\\()`).test(text);
351
+ return new RegExp(`\\b${escapeRegExp(name)}\\b(?=\\s*[<(])`).test(text);
352
352
  });
353
353
  });
354
354
  }
@@ -1045,7 +1045,7 @@ const printerFaker = kubb_kit.ast.createPrinter((options) => {
1045
1045
  if (this.options.schemaName && refName === this.options.schemaName) return this.options.typeName ? `undefined as unknown as ${this.options.typeName}` : "undefined as unknown";
1046
1046
  const resolvedName = node.ref ? this.options.resolver.name(refName) : refName;
1047
1047
  if (!this.options.nestedInObject) return `${resolvedName}(data)`;
1048
- return `${resolvedName}()`;
1048
+ return `${resolvedName}${this.options.nestedInUnion && (node.schema?.type === "object" || node.schema?.type === "intersection") ? "<object>" : ""}()`;
1049
1049
  },
1050
1050
  enum(node) {
1051
1051
  return fakerKeywordMapper.enum(getEnumValues(node).map(parseEnumValue), this.options.typeName);