From 3b5b5eeba8d306fb0be96a15c3b5edc9edec07cf Mon Sep 17 00:00:00 2001 From: sinclair Date: Wed, 22 Nov 2023 14:09:05 +0900 Subject: [PATCH] Reimplement Index Types --- examples/index.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/examples/index.ts b/examples/index.ts index 2c42027c..a55d0f02 100644 --- a/examples/index.ts +++ b/examples/index.ts @@ -4,6 +4,8 @@ import { Value, ValuePointer } from '@sinclair/typebox/value' import { Type, TypeGuard, Kind, Static, TSchema, TProperties, TArray, TLiteral, TTemplateLiteral } from '@sinclair/typebox' import { TObject, TUnion, TInteger, TBigInt, TIntersect, TString, TNumber, TBoolean, TNever, TTuple, UnionType, TRecursive } from '@sinclair/typebox' +export type EmptyString = '' + // ------------------------------------------------------------------ // TemplateLiteralFinite // ------------------------------------------------------------------ @@ -56,16 +58,13 @@ export type TTemplateLiteralConst = T extends TBoolean ? `${boolean}` : never // prettier-ignore -export type TTemplateLiteralUnion = +export type TTemplateLiteralUnion = T extends [infer L, ...infer R] ? `${TTemplateLiteralConst}${TTemplateLiteralUnion, Acc>}` : Acc -// export type TTemplateLiteralKind = TUnion | TLiteral | TInteger | TTemplateLiteral | TNumber | TBigInt | TString | TBoolean | TNever // ------------------------------------------------------------------ // TIndexer // ------------------------------------------------------------------ -export type EmptyString = '' - // prettier-ignore export type TIndexerUnion = T extends [infer L extends TSchema, ...infer R extends TSchema[]]