Files
NapCatQQ/.pnpm-store/v3/files/c0/a2c43e693d1f62a66b31c578d6451b665da09be14d16bcb8a507323a5fea0dc318a5beddf3a24a4cdbb49b1240159bd9c94b39b61a63ba70520cf0172f704d
TanTan e311ca3275
Build NapCat Artifacts / Windows Loader Test (push) Canceled after 0s
Build NapCat Artifacts / Type Check & Test (push) Canceled after 0s
Build NapCat Artifacts / Build NapCat.Framework (push) Canceled after 0s
Build NapCat Artifacts / Build NapCat.Shell (push) Canceled after 0s
docs: 仓库链接指向本镜像仓库
2026-11-13 09:25:58 +08:00

42 lines
1.4 KiB
Plaintext

import type { TSchema, SchemaOptions } from '../schema/index.mjs';
import { Kind } from '../symbols/index.mjs';
import { TUnsafe } from '../unsafe/index.mjs';
import { Static } from '../static/index.mjs';
export interface TRef<Ref extends string = string> extends TSchema {
[Kind]: 'Ref';
static: unknown;
$ref: Ref;
}
export type TRefUnsafe<Type extends TSchema> = TUnsafe<Static<Type>>;
/** `[Json]` Creates a Ref type.*/
export declare function Ref<Ref extends string>($ref: Ref, options?: SchemaOptions): TRef<Ref>;
/**
* @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)
* ```
* should be changed to the following
*
* ```typescript
* // 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>;