Files
NapCatQQ/.pnpm-store/v3/files/42/f49bb82fa1f6e80b8dcc64cdcf09b88be30bb770ac13438cd1ced6eff28437180197f435c91d325bfbb9dbfed3f63778078edd78502d23899fc0a762796ce7
T
TanTan e311ca3275
Build NapCat Artifacts / Type Check & Test (push) Waiting to run
docs: 仓库链接指向本镜像仓库
2026-11-13 09:25:58 +08:00

17 lines
695 B
Plaintext

import * as t from '../type/index.mjs';
import { Type } from './parser.mjs';
/** `[Experimental]` Parses type expressions into TypeBox types but does not infer */
// prettier-ignore
export function NoInfer(...args) {
const withContext = typeof args[0] === 'string' ? false : true;
const [context, code, options] = withContext ? [args[0], args[1], args[2] || {}] : [{}, args[0], args[1] || {}];
const result = Type(code, context)[0];
return t.KindGuard.IsSchema(result)
? t.CloneType(result, options)
: t.Never(options);
}
/** `[Experimental]` Parses type expressions into TypeBox types */
export function Syntax(...args) {
return NoInfer.apply(null, args);
}