import { type TUnreachable } from '../../../system/unreachable/index.mjs'; import { type TSchema } from '../../types/schema.mjs'; import { type TLiteral, type TLiteralValue } from '../../types/literal.mjs'; import { type TString } from '../../types/string.mjs'; import { type TTemplateLiteral } from '../../types/template_literal.mjs'; import { type TUnion } from '../../types/union.mjs'; import { type TParsePatternIntoTypes } from '../patterns/pattern.mjs'; import { type TIsTemplateLiteralFinite } from './is_finite.mjs'; type TFromLiteralPush = Variants extends [infer Left extends string, ...infer Right extends string[]] ? TFromLiteralPush : Result; type TFromLiteral = Variants extends [] ? [`${Value}`] : TFromLiteralPush; type TFromUnion = Types extends [infer Left extends TSchema, ...infer Right extends TSchema[]] ? TFromUnion]> : Result; type TFromType ? TFromUnion : Type extends TLiteral ? TFromLiteral : TUnreachable)> = Result; type TDecodeFromSpan = Types extends [infer Left extends TSchema, ...infer Right extends TSchema[]] ? TDecodeFromSpan, Right> : Variants; type TVariantsToLiterals = Variants extends [infer Left extends string, ...infer Right extends string[]] ? TVariantsToLiterals]> : Result; type TDecodeTypesAsUnion, Literals extends TSchema[] = TVariantsToLiterals, Result extends TSchema = TUnion> = Result; type TDecodeTypes)> = Result; /** Decodes a TemplateLiteral into a Type. */ export type TTemplateLiteralDecodeUnsafe, Result extends TSchema = (Types extends [] ? TString : TIsTemplateLiteralFinite extends true ? TDecodeTypes : TTemplateLiteral)> = Result; /** * (Internal) Decodes a TemplateLiteral pattern into a Type. This function is unsafe. Decoding a non-finite * TemplateLiteral pattern may produce another TemplateLiteral pattern. During enumeration, this * TemplateLiteral -> TemplateLiteral behavior can cause a StackOverflow. A better in-flight template-literal * decoding algorithm is needed. (for review) */ export declare function TemplateLiteralDecodeUnsafe(pattern: Pattern): TTemplateLiteralDecodeUnsafe; /** Decodes a TemplateLiteral pattern but returns TString if the pattern in non-finite. */ export type TTemplateLiteralDecode, Result extends TSchema = Decoded extends TTemplateLiteral ? TString : Decoded> = Result; /** Decodes a TemplateLiteral pattern but returns TString if the pattern in non-finite. */ export declare function TemplateLiteralDecode(pattern: Pattern): TTemplateLiteralDecode; export {};