@sdk-it/typescript 0.46.4 → 0.46.5

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.js CHANGED
@@ -483,10 +483,10 @@ var TypeScriptEmitter = class {
483
483
  if (types.length > 1) {
484
484
  const realTypes = types.filter((t) => t !== "null");
485
485
  if (realTypes.length === 1 && types.includes("null")) {
486
- const tsType = this.normal(realTypes[0], schema, false);
486
+ const tsType = this.normal(realTypes[0], schema, true);
487
487
  return appendOptional(`${tsType} | null`, required);
488
488
  }
489
- const typeResults = types.map((t) => this.normal(t, schema, false));
489
+ const typeResults = types.map((t) => this.normal(t, schema, true));
490
490
  return appendOptional(typeResults.join(" | "), required);
491
491
  }
492
492
  return this.normal(types[0], schema, required);
@@ -771,9 +771,16 @@ var ZodEmitter = class {
771
771
  if (types.length > 1) {
772
772
  const realTypes = types.filter((t) => t !== "null");
773
773
  if (realTypes.length === 1 && types.includes("null")) {
774
- return this.normal(realTypes[0], schema, required, true);
774
+ return this.normal(
775
+ realTypes[0],
776
+ { ...schema, type: realTypes[0] },
777
+ required,
778
+ true
779
+ );
775
780
  }
776
- const subSchemas = types.map((t) => this.normal(t, schema, false));
781
+ const subSchemas = types.map(
782
+ (t) => this.normal(t, { ...schema, type: t }, true)
783
+ );
777
784
  return `z.union([${subSchemas.join(", ")}])${appendOptional2(required)}`;
778
785
  }
779
786
  return this.normal(types[0], schema, required, false);
@@ -1846,7 +1853,7 @@ function applyCredential(
1846
1853
  config.url.searchParams.set(scheme.name, credential);
1847
1854
  }
1848
1855
  } else if (scheme.in === 'cookie') {
1849
- if (typeof document !== 'undefined') {
1856
+ if ('document' in globalThis) {
1850
1857
  throw new Error(
1851
1858
  \`Cannot send the \${scheme.name} cookie credential: browsers forbid setting the Cookie header. Let the browser send the cookie and pass a fetch that sets credentials: 'include'.\`,
1852
1859
  );