@sinclair/typebox 0.24.1 → 0.24.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sinclair/typebox",
3
- "version": "0.24.1",
3
+ "version": "0.24.2",
4
4
  "description": "JSONSchema Type Builder with Static Type Resolution for TypeScript",
5
5
  "keywords": [
6
6
  "json-schema",
package/typebox.d.ts CHANGED
@@ -266,8 +266,11 @@ export interface TUnknown extends TSchema {
266
266
  [Kind]: 'Unknown';
267
267
  static: unknown;
268
268
  }
269
+ export interface UnsafeOptions extends SchemaOptions {
270
+ [Kind]?: string;
271
+ }
269
272
  export interface TUnsafe<T> extends TSchema {
270
- [Kind]: 'Unknown';
273
+ [Kind]: string;
271
274
  static: T;
272
275
  }
273
276
  export interface TVoid extends TSchema {
@@ -347,7 +350,7 @@ export declare class TypeBuilder {
347
350
  /** Creates an unknown type */
348
351
  Unknown(options?: SchemaOptions): TUnknown;
349
352
  /** Creates a user defined schema that infers as type T */
350
- Unsafe<T>(options?: SchemaOptions): TUnsafe<T>;
353
+ Unsafe<T>(options?: UnsafeOptions): TUnsafe<T>;
351
354
  /** Creates a void type */
352
355
  Void(options?: SchemaOptions): TVoid;
353
356
  /** Use this function to return TSchema with static and params omitted */
package/typebox.js CHANGED
@@ -293,7 +293,7 @@ class TypeBuilder {
293
293
  }
294
294
  /** Creates a user defined schema that infers as type T */
295
295
  Unsafe(options = {}) {
296
- return this.Create({ ...options, [exports.Kind]: 'Unknown' });
296
+ return this.Create({ ...options, [exports.Kind]: options[exports.Kind] || 'Unsafe' });
297
297
  }
298
298
  /** Creates a void type */
299
299
  Void(options = {}) {