• [Json] Creates a Ref type.

    Type Parameters

    • Ref extends string

    Parameters

    Returns TRef<Ref>

  • Type Parameters

    Parameters

    Returns TRefUnsafe<Type>

    [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.

    // pre-0.34.0

    const T = Type.String({ $id: 'T' })

    const R = Type.Ref(T)

    should be changed to the following

    // 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

    const LegacyRef = <T extends TSchema>(schema: T) => Type.Unsafe<Static<T>>(Type.Ref(schema.$id!))