Files
NapCatQQ/.pnpm-store/v3/files/8d/a76ab46ca696f04a5d63d9546b47f424d662c8bbe81731a3e16779be316e97ec56303d07d48054b7677542ff439e5d39b55d2910861335cb3eac68f5618dab
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

31 lines
2.0 KiB
Plaintext

import type { TSchema, SchemaOptions } from '../schema/index';
import type { Assert } from '../helpers/index';
import type { TUnion } from '../union/index';
import type { TLiteral } from '../literal/index';
import type { TInteger } from '../integer/index';
import type { TNumber } from '../number/index';
import type { TBigInt } from '../bigint/index';
import type { TString } from '../string/index';
import type { TBoolean } from '../boolean/index';
import type { TNever } from '../never/index';
import type { Static } from '../static/index';
import { type TTemplateLiteralSyntax } from './syntax';
import { EmptyString } from '../helpers/index';
import { Kind } from '../symbols/index';
type TemplateLiteralStaticKind<T, Acc extends string> = T extends TUnion<infer U> ? {
[K in keyof U]: TemplateLiteralStatic<Assert<[U[K]], TTemplateLiteralKind[]>, Acc>;
}[number] : T extends TTemplateLiteral ? `${Static<T>}` : T extends TLiteral<infer U> ? `${U}` : T extends TString ? `${string}` : T extends TNumber ? `${number}` : T extends TBigInt ? `${bigint}` : T extends TBoolean ? `${boolean}` : never;
type TemplateLiteralStatic<T extends TTemplateLiteralKind[], Acc extends string> = T extends [infer L, ...infer R] ? `${TemplateLiteralStaticKind<L, Acc>}${TemplateLiteralStatic<Assert<R, TTemplateLiteralKind[]>, Acc>}` : Acc;
export type TTemplateLiteralKind = TTemplateLiteral | TUnion | TLiteral | TInteger | TNumber | TBigInt | TString | TBoolean | TNever;
export interface TTemplateLiteral<T extends TTemplateLiteralKind[] = TTemplateLiteralKind[]> extends TSchema {
[Kind]: 'TemplateLiteral';
static: TemplateLiteralStatic<T, EmptyString>;
type: 'string';
pattern: string;
}
/** `[Json]` Creates a TemplateLiteral type from template dsl string */
export declare function TemplateLiteral<T extends string>(syntax: T, options?: SchemaOptions): TTemplateLiteralSyntax<T>;
/** `[Json]` Creates a TemplateLiteral type */
export declare function TemplateLiteral<T extends TTemplateLiteralKind[]>(kinds: [...T], options?: SchemaOptions): TTemplateLiteral<T>;
export {};