Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@sinclair/typebox

Package Overview
Dependencies
Maintainers
0
Versions
348
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sinclair/typebox - npm Package Compare versions

Comparing version 0.34.12 to 0.34.13

25

build/cjs/type/ref/ref.d.ts

@@ -14,16 +14,29 @@ import type { TSchema, SchemaOptions } from '../schema/index';

/**
* @deprecated `[Json]` Creates a Ref type. The referenced type MUST contain a $id. The Ref(TSchema) signature was
* deprecated on 0.34.0 in support of a new type referencing model (Module). Existing implementations using Ref(TSchema)
* can migrate using the following. The Ref(TSchema) validation behavior of Ref will be preserved how the construction
* of legacy Ref(TSchema) will require wrapping in TUnsafe (where TUnsafe is used for inference only)
* @deprecated `[Json]` Creates a Ref type. This signature was deprecated in 0.34.0 where Ref requires callers to pass
* a `string` value for the reference (and not a schema).
*
* To adhere to the 0.34.0 signature, Ref implementations should be updated to the following.
*
* ```typescript
* // pre-0.34.0
*
* const T = Type.String({ $id: 'T' })
*
* const R = Type.Ref(T)
* ```
* to
* should be changed to the following
*
* ```typescript
* const R = Type.Unsafe<Static<T>>(T.$id)
* // post-0.34.0
*
* const T = Type.String({ $id: 'T' })
*
* const R = Type.Unsafe<Static<typeof T>>(Type.Ref('T'))
* ```
* You can also create a generic function to replicate the pre-0.34.0 signature if required
*
* ```typescript
* const LegacyRef = <T extends TSchema>(schema: T) => Type.Unsafe<Static<T>>(Type.Ref(schema.$id!))
* ```
*/
export declare function Ref<Type extends TSchema>(type: Type, options?: SchemaOptions): TRefUnsafe<Type>;

@@ -154,15 +154,28 @@ import { type TAny } from '../any/index';

/**
* @deprecated `[Json]` Creates a Ref type. The referenced type MUST contain a $id. The Ref(TSchema) signature was
* deprecated on 0.34.0 in support of a new type referencing model (Module). Existing implementations using Ref(TSchema)
* can migrate using the following. The Ref(TSchema) validation behavior of Ref will be preserved how the construction
* of legacy Ref(TSchema) will require wrapping in TUnsafe (where TUnsafe is used for inference only)
* @deprecated `[Json]` Creates a Ref type. This signature was deprecated in 0.34.0 where Ref requires callers to pass
* a `string` value for the reference (and not a schema).
*
* To adhere to the 0.34.0 signature, Ref implementations should be updated to the following.
*
* ```typescript
* // pre-0.34.0
*
* const T = Type.String({ $id: 'T' })
*
* const R = Type.Ref(T)
* ```
* to
* should be changed to the following
*
* ```typescript
* const R = Type.Unsafe<Static<T>>(T.$id)
* // post-0.34.0
*
* const T = Type.String({ $id: 'T' })
*
* const R = Type.Unsafe<Static<typeof T>>(Type.Ref('T'))
* ```
* You can also create a generic function to replicate the pre-0.34.0 signature if required
*
* ```typescript
* const LegacyRef = <T extends TSchema>(schema: T) => Type.Unsafe<Static<T>>(Type.Ref(schema.$id!))
* ```
*/

@@ -169,0 +182,0 @@ Ref<Type extends TSchema>(type: Type, options?: SchemaOptions): TRefUnsafe<Type>;

@@ -73,3 +73,3 @@ "use strict";

function TryConvertString(value) {
return IsValueToString(value) ? value.toString() : (0, index_5.IsSymbol)(value) && value.description !== undefined ? value.description.toString() : value;
return (0, index_5.IsSymbol)(value) && value.description !== undefined ? value.description.toString() : IsValueToString(value) ? value.toString() : value;
}

@@ -76,0 +76,0 @@ function TryConvertNumber(value) {

{
"name": "@sinclair/typebox",
"version": "0.34.12",
"version": "0.34.13",
"description": "Json Schema Type Builder with Static Type Resolution for TypeScript",

@@ -5,0 +5,0 @@ "keywords": [

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc