Files
NapCatQQ/.pnpm-store/v3/files/ef/4490cd5a656c009ba5f250a0595bd6f0029328638feae213335a8faefd5a05faf66203966ad1963829a383fad6bf0024228d41c789c90f1b38d9f05cb3e551
T
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

16 lines
642 B
Plaintext

import { CloneType } from '../clone/type.mjs';
import { CreateType } from '../create/type.mjs';
import { IsUndefined } from '../guard/value.mjs';
import { Kind, Hint } from '../symbols/index.mjs';
// Auto Tracked For Recursive Types without ID's
let Ordinal = 0;
/** `[Json]` Creates a Recursive type */
export function Recursive(callback, options = {}) {
if (IsUndefined(options.$id))
options.$id = `T${Ordinal++}`;
const thisType = CloneType(callback({ [Kind]: 'This', $ref: `${options.$id}` }));
thisType.$id = options.$id;
// prettier-ignore
return CreateType({ [Hint]: 'Recursive', ...thisType }, options);
}