typebox 1.1.32 → 1.1.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/system/locale/_config.d.mts +1 -1
- package/build/system/locale/ar_001.d.mts +1 -1
- package/build/system/locale/bn_BD.d.mts +1 -1
- package/build/system/locale/cs_CZ.d.mts +1 -1
- package/build/system/locale/de_DE.d.mts +1 -1
- package/build/system/locale/el_GR.d.mts +1 -1
- package/build/system/locale/en_US.d.mts +1 -1
- package/build/system/locale/es_419.d.mts +1 -1
- package/build/system/locale/es_AR.d.mts +1 -1
- package/build/system/locale/es_ES.d.mts +1 -1
- package/build/system/locale/es_MX.d.mts +1 -1
- package/build/system/locale/fa_IR.d.mts +1 -1
- package/build/system/locale/fil_PH.d.mts +1 -1
- package/build/system/locale/fr_CA.d.mts +1 -1
- package/build/system/locale/fr_FR.d.mts +1 -1
- package/build/system/locale/ha_NG.d.mts +1 -1
- package/build/system/locale/hi_IN.d.mts +1 -1
- package/build/system/locale/hu_HU.d.mts +1 -1
- package/build/system/locale/id_ID.d.mts +1 -1
- package/build/system/locale/it_IT.d.mts +1 -1
- package/build/system/locale/ja_JP.d.mts +1 -1
- package/build/system/locale/ko_KR.d.mts +1 -1
- package/build/system/locale/ms_MY.d.mts +1 -1
- package/build/system/locale/nl_NL.d.mts +1 -1
- package/build/system/locale/pl_PL.d.mts +1 -1
- package/build/system/locale/pt_BR.d.mts +1 -1
- package/build/system/locale/pt_PT.d.mts +1 -1
- package/build/system/locale/ro_RO.d.mts +1 -1
- package/build/system/locale/ru_RU.d.mts +1 -1
- package/build/system/locale/sv_SE.d.mts +1 -1
- package/build/system/locale/sw_TZ.d.mts +1 -1
- package/build/system/locale/th_TH.d.mts +1 -1
- package/build/system/locale/tr_TR.d.mts +1 -1
- package/build/system/locale/uk_UA.d.mts +1 -1
- package/build/system/locale/ur_PK.d.mts +1 -1
- package/build/system/locale/vi_VN.d.mts +1 -1
- package/build/system/locale/yo_NG.d.mts +1 -1
- package/build/system/locale/zh_Hans.d.mts +1 -1
- package/build/system/locale/zh_Hant.d.mts +1 -1
- package/build/type/engine/call/distribute-arguments.mjs +1 -7
- package/build/type/engine/cyclic/candidates.d.mts +1 -1
- package/build/type/engine/evaluate/flatten.d.mts +1 -1
- package/build/type/engine/evaluate/narrow.d.mts +3 -3
- package/build/type/engine/indexable/from-literal.d.mts +1 -1
- package/build/type/engine/indexable/from-type.d.mts +6 -6
- package/build/type/engine/instantiate.d.mts +2 -2
- package/build/type/engine/instantiate.mjs +2 -2
- package/build/type/engine/ref/instantiate.d.mts +1 -1
- package/build/type/engine/template-literal/decode.d.mts +1 -1
- package/build/type/engine/template-literal/encode.d.mts +1 -1
- package/build/type/engine/this/expand-this.mjs +6 -6
- package/build/type/extends/literal.d.mts +1 -1
- package/build/type/extends/literal.mjs +1 -1
- package/build/type/extends/result.d.mts +1 -1
- package/build/type/script/token/internal/guard.d.mts +1 -1
- package/build/type/script/token/internal/guard.mjs +1 -1
- package/build/type/script/token/internal/take.mjs +5 -9
- package/build/type/script/token/until.mjs +4 -7
- package/build/type/types/array.d.mts +2 -1
- package/build/type/types/array.mjs +2 -1
- package/build/type/types/function.mjs +1 -1
- package/build/type/types/object.mjs +1 -1
- package/build/value/clean/from-cyclic.d.mts +1 -1
- package/build/value/convert/from-literal.d.mts +1 -1
- package/build/value/convert/try/try-bigint.d.mts +1 -1
- package/build/value/convert/try/try-boolean.d.mts +1 -1
- package/build/value/convert/try/try-null.d.mts +1 -1
- package/build/value/convert/try/try-number.d.mts +1 -1
- package/build/value/convert/try/try-string.d.mts +1 -1
- package/build/value/convert/try/try-undefined.d.mts +1 -1
- package/build/value/default/from-intersect.d.mts +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TLocalizedValidationMessageCallback } from '../../error/index.mjs';
|
|
1
|
+
import { type TLocalizedValidationMessageCallback } from '../../error/index.mjs';
|
|
2
2
|
/** Sets the locale */
|
|
3
3
|
export declare function Set(callback: TLocalizedValidationMessageCallback): void;
|
|
4
4
|
/** Gets the locale */
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { TValidationError } from '../../error/index.mjs';
|
|
1
|
+
import { type TValidationError } from '../../error/index.mjs';
|
|
2
2
|
/** Arabic (World) - ISO 639-1 language code 'ar' with UN M.49 region code '001' for World. */
|
|
3
3
|
export declare function ar_001(error: TValidationError): string;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { TValidationError } from '../../error/index.mjs';
|
|
1
|
+
import { type TValidationError } from '../../error/index.mjs';
|
|
2
2
|
/** Bengali (Bangladesh) - ISO 639-1 language code 'bn' with ISO 3166-1 alpha-2 country code 'BD' for Bangladesh. */
|
|
3
3
|
export declare function bn_BD(error: TValidationError): string;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { TValidationError } from '../../error/index.mjs';
|
|
1
|
+
import { type TValidationError } from '../../error/index.mjs';
|
|
2
2
|
/** Czech (Czech Republic) - ISO 639-1 language code 'cs' with ISO 3166-1 alpha-2 country code 'CZ' for Czech Republic. */
|
|
3
3
|
export declare function cs_CZ(error: TValidationError): string;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { TValidationError } from '../../error/index.mjs';
|
|
1
|
+
import { type TValidationError } from '../../error/index.mjs';
|
|
2
2
|
/** German (Germany) - ISO 639-1 language code 'de' with ISO 3166-1 alpha-2 country code 'DE' for Germany. */
|
|
3
3
|
export declare function de_DE(error: TValidationError): string;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { TValidationError } from '../../error/index.mjs';
|
|
1
|
+
import { type TValidationError } from '../../error/index.mjs';
|
|
2
2
|
/** Greek (Greece) - ISO 639-1 language code 'el' with ISO 3166-1 alpha-2 country code 'GR' for Greece. */
|
|
3
3
|
export declare function el_GR(error: TValidationError): string;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { TValidationError } from '../../error/index.mjs';
|
|
1
|
+
import { type TValidationError } from '../../error/index.mjs';
|
|
2
2
|
/** en_US: English (United States) - ISO 639-1 language code 'en' with ISO 3166-1 alpha-2 country code 'US' for United States. */
|
|
3
3
|
export declare function en_US(error: TValidationError): string;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { TValidationError } from '../../error/index.mjs';
|
|
1
|
+
import { type TValidationError } from '../../error/index.mjs';
|
|
2
2
|
/** Spanish (Latin America) - ISO 639-1 language code 'es' with UN M.49 region code '419' for Latin America and the Caribbean. */
|
|
3
3
|
export declare function es_419(error: TValidationError): string;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { TValidationError } from '../../error/index.mjs';
|
|
1
|
+
import { type TValidationError } from '../../error/index.mjs';
|
|
2
2
|
/** Spanish (Argentina) - ISO 639-1 language code 'es' with ISO 3166-1 alpha-2 country code 'AR' for Argentina. */
|
|
3
3
|
export declare function es_AR(error: TValidationError): string;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { TValidationError } from '../../error/index.mjs';
|
|
1
|
+
import { type TValidationError } from '../../error/index.mjs';
|
|
2
2
|
/** Spanish (Spain) - ISO 639-1 language code 'es' with ISO 3166-1 alpha-2 country code 'ES' for Spain. */
|
|
3
3
|
export declare function es_ES(error: TValidationError): string;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { TValidationError } from '../../error/index.mjs';
|
|
1
|
+
import { type TValidationError } from '../../error/index.mjs';
|
|
2
2
|
/** Spanish (Mexico) - ISO 639-1 language code 'es' with ISO 3166-1 alpha-2 country code 'MX' for Mexico. */
|
|
3
3
|
export declare function es_MX(error: TValidationError): string;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { TValidationError } from '../../error/index.mjs';
|
|
1
|
+
import { type TValidationError } from '../../error/index.mjs';
|
|
2
2
|
/** Persian (Iran) - ISO 639-1 language code 'fa' with ISO 3166-1 alpha-2 country code 'IR' for Iran. */
|
|
3
3
|
export declare function fa_IR(error: TValidationError): string;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { TValidationError } from '../../error/index.mjs';
|
|
1
|
+
import { type TValidationError } from '../../error/index.mjs';
|
|
2
2
|
/** French (Canada) - ISO 639-1 language code 'fr' with ISO 3166-1 alpha-2 country code 'CA' for Canada. */
|
|
3
3
|
export declare function fr_CA(error: TValidationError): string;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { TValidationError } from '../../error/index.mjs';
|
|
1
|
+
import { type TValidationError } from '../../error/index.mjs';
|
|
2
2
|
/** French (France) - ISO 639-1 language code 'fr' with ISO 3166-1 alpha-2 country code 'FR' for France. */
|
|
3
3
|
export declare function fr_FR(error: TValidationError): string;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { TValidationError } from '../../error/index.mjs';
|
|
1
|
+
import { type TValidationError } from '../../error/index.mjs';
|
|
2
2
|
/** Hausa (Nigeria) - ISO 639-1 language code 'ha' with ISO 3166-1 alpha-2 country code 'NG' for Nigeria. */
|
|
3
3
|
export declare function ha_NG(error: TValidationError): string;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { TValidationError } from '../../error/index.mjs';
|
|
1
|
+
import { type TValidationError } from '../../error/index.mjs';
|
|
2
2
|
/** Hindi (India) - ISO 639-1 language code 'hi' with ISO 3166-1 alpha-2 country code 'IN' for India. */
|
|
3
3
|
export declare function hi_IN(error: TValidationError): string;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { TValidationError } from '../../error/index.mjs';
|
|
1
|
+
import { type TValidationError } from '../../error/index.mjs';
|
|
2
2
|
/** Hungarian (Hungary) - ISO 639-1 language code 'hu' with ISO 3166-1 alpha-2 country code 'HU' for Hungary. */
|
|
3
3
|
export declare function hu_HU(error: TValidationError): string;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { TValidationError } from '../../error/index.mjs';
|
|
1
|
+
import { type TValidationError } from '../../error/index.mjs';
|
|
2
2
|
/** Indonesian (Indonesia) - ISO 639-1 language code 'id' with ISO 3166-1 alpha-2 country code 'ID' for Indonesia. */
|
|
3
3
|
export declare function id_ID(error: TValidationError): string;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { TValidationError } from '../../error/index.mjs';
|
|
1
|
+
import { type TValidationError } from '../../error/index.mjs';
|
|
2
2
|
/** Italian (Italy) - ISO 639-1 language code 'it' with ISO 3166-1 alpha-2 country code 'IT' for Italy. */
|
|
3
3
|
export declare function it_IT(error: TValidationError): string;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { TValidationError } from '../../error/index.mjs';
|
|
1
|
+
import { type TValidationError } from '../../error/index.mjs';
|
|
2
2
|
/** Japanese (Japan) - ISO 639-1 language code 'ja' with ISO 3166-1 alpha-2 country code 'JP' for Japan. */
|
|
3
3
|
export declare function ja_JP(error: TValidationError): string;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { TValidationError } from '../../error/index.mjs';
|
|
1
|
+
import { type TValidationError } from '../../error/index.mjs';
|
|
2
2
|
/** Korean (South Korea) - ISO 639-1 language code 'ko' with ISO 3166-1 alpha-2 country code 'KR' for South Korea. */
|
|
3
3
|
export declare function ko_KR(error: TValidationError): string;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { TValidationError } from '../../error/index.mjs';
|
|
1
|
+
import { type TValidationError } from '../../error/index.mjs';
|
|
2
2
|
/** Malay (Malaysia) - ISO 639-1 language code 'ms' with ISO 3166-1 alpha-2 country code 'MY' for Malaysia. */
|
|
3
3
|
export declare function ms_MY(error: TValidationError): string;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { TValidationError } from '../../error/index.mjs';
|
|
1
|
+
import { type TValidationError } from '../../error/index.mjs';
|
|
2
2
|
/** Dutch (Netherlands) - ISO 639-1 language code 'nl' with ISO 3166-1 alpha-2 country code 'NL' for Netherlands. */
|
|
3
3
|
export declare function nl_NL(error: TValidationError): string;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { TValidationError } from '../../error/index.mjs';
|
|
1
|
+
import { type TValidationError } from '../../error/index.mjs';
|
|
2
2
|
/** Polish (Poland) - ISO 639-1 language code 'pl' with ISO 3166-1 alpha-2 country code 'PL' for Poland. */
|
|
3
3
|
export declare function pl_PL(error: TValidationError): string;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { TValidationError } from '../../error/index.mjs';
|
|
1
|
+
import { type TValidationError } from '../../error/index.mjs';
|
|
2
2
|
/** Portuguese (Brazil) - ISO 639-1 language code 'pt' with ISO 3166-1 alpha-2 country code 'BR' for Brazil. */
|
|
3
3
|
export declare function pt_BR(error: TValidationError): string;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { TValidationError } from '../../error/index.mjs';
|
|
1
|
+
import { type TValidationError } from '../../error/index.mjs';
|
|
2
2
|
/** Portuguese (Portugal) - ISO 639-1 language code 'pt' with ISO 3166-1 alpha-2 country code 'PT' for Portugal. */
|
|
3
3
|
export declare function pt_PT(error: TValidationError): string;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { TValidationError } from '../../error/index.mjs';
|
|
1
|
+
import { type TValidationError } from '../../error/index.mjs';
|
|
2
2
|
/** Romanian (Romania) - ISO 639-1 language code 'ro' with ISO 3166-1 alpha-2 country code 'RO' for Romania. */
|
|
3
3
|
export declare function ro_RO(error: TValidationError): string;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { TValidationError } from '../../error/index.mjs';
|
|
1
|
+
import { type TValidationError } from '../../error/index.mjs';
|
|
2
2
|
/** Russian (Russia) - ISO 639-1 language code 'ru' with ISO 3166-1 alpha-2 country code 'RU' for Russia. */
|
|
3
3
|
export declare function ru_RU(error: TValidationError): string;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { TValidationError } from '../../error/index.mjs';
|
|
1
|
+
import { type TValidationError } from '../../error/index.mjs';
|
|
2
2
|
/** Swedish (Sweden) - ISO 639-1 language code 'sv' with ISO 3166-1 alpha-2 country code 'SE' for Sweden. */
|
|
3
3
|
export declare function sv_SE(error: TValidationError): string;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { TValidationError } from '../../error/index.mjs';
|
|
1
|
+
import { type TValidationError } from '../../error/index.mjs';
|
|
2
2
|
/** Swahili (Tanzania) - ISO 639-1 language code 'sw' with ISO 3166-1 alpha-2 country code 'TZ' for Tanzania (as a common representative). */
|
|
3
3
|
export declare function sw_TZ(error: TValidationError): string;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { TValidationError } from '../../error/index.mjs';
|
|
1
|
+
import { type TValidationError } from '../../error/index.mjs';
|
|
2
2
|
/** Thai (Thailand) - ISO 639-1 language code 'th' with ISO 3166-1 alpha-2 country code 'TH' for Thailand. */
|
|
3
3
|
export declare function th_TH(error: TValidationError): string;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { TValidationError } from '../../error/index.mjs';
|
|
1
|
+
import { type TValidationError } from '../../error/index.mjs';
|
|
2
2
|
/** Turkish (Turkey) - ISO 639-1 language code 'tr' with ISO 3166-1 alpha-2 country code 'TR' for Turkey. */
|
|
3
3
|
export declare function tr_TR(error: TValidationError): string;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { TValidationError } from '../../error/index.mjs';
|
|
1
|
+
import { type TValidationError } from '../../error/index.mjs';
|
|
2
2
|
/** Ukrainian (Ukraine) - ISO 639-1 language code 'uk' with ISO 3166-1 alpha-2 country code 'UA' for Ukraine. */
|
|
3
3
|
export declare function uk_UA(error: TValidationError): string;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { TValidationError } from '../../error/index.mjs';
|
|
1
|
+
import { type TValidationError } from '../../error/index.mjs';
|
|
2
2
|
/** Urdu (Pakistan) - ISO 639-1 language code 'ur' with ISO 3166-1 alpha-2 country code 'PK' for Pakistan. */
|
|
3
3
|
export declare function ur_PK(error: TValidationError): string;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { TValidationError } from '../../error/index.mjs';
|
|
1
|
+
import { type TValidationError } from '../../error/index.mjs';
|
|
2
2
|
/** Vietnamese (Vietnam) - ISO 639-1 language code 'vi' with ISO 3166-1 alpha-2 country code 'VN' for Vietnam. */
|
|
3
3
|
export declare function vi_VN(error: TValidationError): string;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { TValidationError } from '../../error/index.mjs';
|
|
1
|
+
import { type TValidationError } from '../../error/index.mjs';
|
|
2
2
|
/** Yoruba (Nigeria) - ISO 639-1 language code 'yo' with ISO 3166-1 alpha-2 country code 'NG' for Nigeria. */
|
|
3
3
|
export declare function yo_NG(error: TValidationError): string;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { TValidationError } from '../../error/index.mjs';
|
|
1
|
+
import { type TValidationError } from '../../error/index.mjs';
|
|
2
2
|
/** Chinese (Simplified) - ISO 639-1 language code 'zh' with script code 'Hans' for Simplified Chinese. */
|
|
3
3
|
export declare function zh_Hans(error: TValidationError): string;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { TValidationError } from '../../error/index.mjs';
|
|
1
|
+
import { type TValidationError } from '../../error/index.mjs';
|
|
2
2
|
/** Chinese (Traditional) - ISO 639-1 language code 'zh' with script code 'Hant' for Traditional Chinese. */
|
|
3
3
|
export declare function zh_Hant(error: TValidationError): string;
|
|
@@ -19,13 +19,7 @@ function BuildDistributionArray(parameters, names) {
|
|
|
19
19
|
return parameters.reduce((result, left) => [...result, names.includes(left.name)], []);
|
|
20
20
|
}
|
|
21
21
|
function ZipDistributionArray(arguments_, distributionArray, result = []) {
|
|
22
|
-
|
|
23
|
-
const [booleanLeft, ...booleanRight] = distributionArray;
|
|
24
|
-
return (Guard.IsGreaterThan(arguments_.length, 0)
|
|
25
|
-
? Guard.IsGreaterThan(distributionArray.length, 0)
|
|
26
|
-
? ZipDistributionArray(argumentRight, booleanRight, [...result, [booleanLeft, argumentLeft]])
|
|
27
|
-
: result
|
|
28
|
-
: result);
|
|
22
|
+
return Guard.TakeLeft(arguments_, (argumentLeft, argumentRight) => Guard.TakeLeft(distributionArray, (booleanLeft, booleanRight) => ZipDistributionArray(argumentRight, booleanRight, [...result, [booleanLeft, argumentLeft]]), () => result), () => result);
|
|
29
23
|
}
|
|
30
24
|
function Expand(type) {
|
|
31
25
|
return (IsUnion(type)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type TUnreachable } from '../../../system/unreachable/index.mjs';
|
|
2
|
-
import { type TProperties, TPropertyKeys } from '../../types/properties.mjs';
|
|
2
|
+
import { type TProperties, type TPropertyKeys } from '../../types/properties.mjs';
|
|
3
3
|
import { type TCyclicCheck } from './check.mjs';
|
|
4
4
|
type TResolveCandidateKeys<Context extends TProperties, Keys extends string[], Result extends string[] = []> = (Keys extends [infer Left extends string, ...infer Right extends string[]] ? Left extends keyof Context ? TCyclicCheck<[Left], Context, Context[Left]> extends true ? TResolveCandidateKeys<Context, Right, [...Result, Left]> : TResolveCandidateKeys<Context, Right, Result> : TUnreachable : Result);
|
|
5
5
|
/** Returns keys for context types that need to be transformed to TCyclic. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TSchema } from '../../types/schema.mjs';
|
|
1
|
+
import { type TSchema } from '../../types/schema.mjs';
|
|
2
2
|
import { type TUnion } from '../../types/union.mjs';
|
|
3
3
|
type TFlattenType<Type extends TSchema, Result extends TSchema[] = Type extends TUnion<infer Types extends TSchema[]> ? TFlatten<Types> : [Type]> = Result;
|
|
4
4
|
export type TFlatten<Types extends TSchema[], Result extends TSchema[] = []> = (Types extends [infer Left extends TSchema, ...infer Right extends TSchema[]] ? TFlatten<Right, [...Result, ...TFlattenType<Left>]> : Result);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { TSchema } from '../../types/schema.mjs';
|
|
2
|
-
import { TNever } from '../../types/never.mjs';
|
|
3
|
-
import { TCompare, TCompareResult, ResultLeftInside, ResultRightInside, ResultEqual } from './compare.mjs';
|
|
1
|
+
import { type TSchema } from '../../types/schema.mjs';
|
|
2
|
+
import { type TNever } from '../../types/never.mjs';
|
|
3
|
+
import { type TCompare, type TCompareResult, ResultLeftInside, ResultRightInside, ResultEqual } from './compare.mjs';
|
|
4
4
|
export type TNarrow<Left extends TSchema, Right extends TSchema, Result extends TCompareResult = TCompare<Left, Right>> = (Result extends typeof ResultLeftInside ? Left : Result extends typeof ResultRightInside ? Right : Result extends typeof ResultEqual ? Right : TNever);
|
|
5
5
|
export declare function Narrow<Left extends TSchema, Right extends TSchema>(left: Left, right: Right): TNarrow<Left, Right>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { TLiteralValue } from '../../types/literal.mjs';
|
|
1
|
+
import { type TLiteralValue } from '../../types/literal.mjs';
|
|
2
2
|
export type TFromLiteral<Value extends TLiteralValue, Result extends string[] = [`${Value}`]> = Result;
|
|
3
3
|
export declare function FromLiteral<Value extends TLiteralValue>(value: Value): TFromLiteral<Value>;
|
|
@@ -6,12 +6,12 @@ import { type TLiteral, type TLiteralValue } from '../../types/literal.mjs';
|
|
|
6
6
|
import { type TProperties } from '../../types/properties.mjs';
|
|
7
7
|
import { type TTemplateLiteral } from '../../types/template-literal.mjs';
|
|
8
8
|
import { type TUnion } from '../../types/union.mjs';
|
|
9
|
-
import { TFromCyclic } from './from-cyclic.mjs';
|
|
10
|
-
import { TFromEnum } from './from-enum.mjs';
|
|
11
|
-
import { TFromIntersect } from './from-intersect.mjs';
|
|
12
|
-
import { TFromLiteral } from './from-literal.mjs';
|
|
13
|
-
import { TFromTemplateLiteral } from './from-template-literal.mjs';
|
|
14
|
-
import { TFromUnion } from './from-union.mjs';
|
|
9
|
+
import { type TFromCyclic } from './from-cyclic.mjs';
|
|
10
|
+
import { type TFromEnum } from './from-enum.mjs';
|
|
11
|
+
import { type TFromIntersect } from './from-intersect.mjs';
|
|
12
|
+
import { type TFromLiteral } from './from-literal.mjs';
|
|
13
|
+
import { type TFromTemplateLiteral } from './from-template-literal.mjs';
|
|
14
|
+
import { type TFromUnion } from './from-union.mjs';
|
|
15
15
|
export type TFromType<Indexer extends TSchema, Result extends string[] = (Indexer extends TCyclic<infer Defs extends TProperties, infer Ref extends string> ? TFromCyclic<Defs, Ref> : Indexer extends TEnum<infer Values extends TEnumValue[]> ? TFromEnum<Values> : Indexer extends TIntersect<infer Types extends TSchema[]> ? TFromIntersect<Types> : Indexer extends TLiteral<infer Value extends TLiteralValue> ? TFromLiteral<Value> : Indexer extends TTemplateLiteral<infer Pattern extends string> ? TFromTemplateLiteral<Pattern> : Indexer extends TUnion<infer Types extends TSchema[]> ? TFromUnion<Types> : [
|
|
16
16
|
])> = Result;
|
|
17
17
|
export declare function FromType<Indexer extends TSchema>(type: Indexer): TFromType<Indexer>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type TImmutable } from '../types/_immutable.mjs';
|
|
2
|
-
import { type TOptional, TOptionalAdd, TOptionalRemove } from '../types/_optional.mjs';
|
|
3
|
-
import { type TReadonly, TReadonlyAdd, TReadonlyRemove } from '../types/_readonly.mjs';
|
|
2
|
+
import { type TOptional, type TOptionalAdd, type TOptionalRemove } from '../types/_optional.mjs';
|
|
3
|
+
import { type TReadonly, type TReadonlyAdd, type TReadonlyRemove } from '../types/_readonly.mjs';
|
|
4
4
|
import { type TSchema } from '../types/schema.mjs';
|
|
5
5
|
import { type TArray } from '../types/array.mjs';
|
|
6
6
|
import { type TAsyncIterator } from '../types/async-iterator.mjs';
|
|
@@ -11,7 +11,7 @@ import { IsReadonly, ReadonlyAdd, ReadonlyRemove } from '../types/_readonly.mjs'
|
|
|
11
11
|
// Types
|
|
12
12
|
// ------------------------------------------------------------------
|
|
13
13
|
import { IsBase } from '../types/base.mjs';
|
|
14
|
-
import {
|
|
14
|
+
import { _Array_, IsArray, ArrayOptions } from '../types/array.mjs';
|
|
15
15
|
import { AsyncIterator, IsAsyncIterator, AsyncIteratorOptions } from '../types/async-iterator.mjs';
|
|
16
16
|
import { Constructor, IsConstructor, ConstructorOptions } from '../types/constructor.mjs';
|
|
17
17
|
import { Deferred, IsDeferred } from '../types/deferred.mjs';
|
|
@@ -134,7 +134,7 @@ export function InstantiateType(context, state, input) {
|
|
|
134
134
|
const modifiers = ModifierActions(input, IsReadonly(input) ? 'add' : 'none', IsOptional(input) ? 'add' : 'none');
|
|
135
135
|
const type = IsBase(modifiers[0]) ? modifiers[0].Clone() : modifiers[0];
|
|
136
136
|
const instantiated = (IsRef(type) ? RefInstantiate(context, state, type, type.$ref) :
|
|
137
|
-
IsArray(type) ?
|
|
137
|
+
IsArray(type) ? _Array_(InstantiateType(context, state, type.items), ArrayOptions(type)) :
|
|
138
138
|
IsAsyncIterator(type) ? AsyncIterator(InstantiateType(context, state, type.iteratorItems), AsyncIteratorOptions(type)) :
|
|
139
139
|
IsCall(type) ? CallInstantiate(context, state, type.target, type.arguments) :
|
|
140
140
|
IsConstructor(type) ? Constructor(InstantiateTypes(context, state, type.parameters), InstantiateType(context, state, type.instanceType), ConstructorOptions(type)) :
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TProperties } from '../../types/properties.mjs';
|
|
1
|
+
import { type TProperties } from '../../types/properties.mjs';
|
|
2
2
|
import { type TState, type TInstantiateType } from '../instantiate.mjs';
|
|
3
3
|
import { type TCyclicCheck } from '../cyclic/check.mjs';
|
|
4
4
|
import { type TRef } from '../../types/ref.mjs';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TUnreachable } from '../../../system/unreachable/index.mjs';
|
|
1
|
+
import { type TUnreachable } from '../../../system/unreachable/index.mjs';
|
|
2
2
|
import { type TSchema } from '../../types/schema.mjs';
|
|
3
3
|
import { type TLiteral, type TLiteralValue } from '../../types/literal.mjs';
|
|
4
4
|
import { type TString } from '../../types/string.mjs';
|
|
@@ -2,7 +2,7 @@ import { type TSchema } from '../../types/schema.mjs';
|
|
|
2
2
|
import { type TEnum, type TEnumValue } from '../../types/enum.mjs';
|
|
3
3
|
import { type TLiteral, type TLiteralValue } from '../../types/literal.mjs';
|
|
4
4
|
import { type TUnion } from '../../types/union.mjs';
|
|
5
|
-
import { type TTemplateLiteral, TTemplateLiteralDeferred } from '../../types/template-literal.mjs';
|
|
5
|
+
import { type TTemplateLiteral, type TTemplateLiteralDeferred } from '../../types/template-literal.mjs';
|
|
6
6
|
import { type TBigInt, BigIntPattern } from '../../types/bigint.mjs';
|
|
7
7
|
import { type TString, StringPattern } from '../../types/string.mjs';
|
|
8
8
|
import { type TNumber, NumberPattern } from '../../types/number.mjs';
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// deno-fmt-ignore-file
|
|
2
|
-
import { IsArray,
|
|
2
|
+
import { IsArray, _Array_ } from '../../types/array.mjs';
|
|
3
3
|
import { IsAsyncIterator, AsyncIterator } from '../../types/async-iterator.mjs';
|
|
4
4
|
import { IsConstructor, Constructor } from '../../types/constructor.mjs';
|
|
5
|
-
import { IsFunction,
|
|
5
|
+
import { IsFunction, _Function_ } from '../../types/function.mjs';
|
|
6
6
|
import { IsIterator, Iterator } from '../../types/iterator.mjs';
|
|
7
7
|
import { IsIntersect, Intersect } from '../../types/intersect.mjs';
|
|
8
|
-
import {
|
|
8
|
+
import { _Object_ } from '../../types/object.mjs';
|
|
9
9
|
import { IsPromise, Promise } from '../../types/promise.mjs';
|
|
10
10
|
import { IsTuple, Tuple } from '../../types/tuple.mjs';
|
|
11
11
|
import { IsThis } from '../../types/this.mjs';
|
|
@@ -14,16 +14,16 @@ function FromTypes(properties, types) {
|
|
|
14
14
|
return types.map(type => FromType(properties, type));
|
|
15
15
|
}
|
|
16
16
|
export function FromType(properties, type) {
|
|
17
|
-
return (IsArray(type) ?
|
|
17
|
+
return (IsArray(type) ? _Array_(FromType(properties, type.items)) :
|
|
18
18
|
IsAsyncIterator(type) ? AsyncIterator(FromType(properties, type.iteratorItems)) :
|
|
19
19
|
IsConstructor(type) ? Constructor(FromTypes(properties, type.parameters), FromType(properties, type.instanceType)) :
|
|
20
|
-
IsFunction(type) ?
|
|
20
|
+
IsFunction(type) ? _Function_(FromTypes(properties, type.parameters), FromType(properties, type.returnType)) :
|
|
21
21
|
IsIterator(type) ? Iterator(FromType(properties, type.iteratorItems)) :
|
|
22
22
|
IsPromise(type) ? Promise(FromType(properties, type.item)) :
|
|
23
23
|
IsTuple(type) ? Tuple(FromTypes(properties, type.items)) :
|
|
24
24
|
IsUnion(type) ? Union(FromTypes(properties, type.anyOf)) :
|
|
25
25
|
IsIntersect(type) ? Intersect(FromTypes(properties, type.allOf)) :
|
|
26
|
-
IsThis(type) ?
|
|
26
|
+
IsThis(type) ? _Object_(properties) :
|
|
27
27
|
type);
|
|
28
28
|
}
|
|
29
29
|
export function ExpandThis(properties, type) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TUnreachable } from '../../system/unreachable/unreachable.mjs';
|
|
1
|
+
import { type TUnreachable } from '../../system/unreachable/unreachable.mjs';
|
|
2
2
|
import { type TSchema } from '../types/schema.mjs';
|
|
3
3
|
import { type TProperties } from '../types/properties.mjs';
|
|
4
4
|
import { type TLiteral, type TLiteralValue } from '../types/literal.mjs';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// deno-fmt-ignore-file
|
|
2
|
-
import { Unreachable } from '../../system/unreachable/unreachable.mjs';
|
|
3
2
|
import { Guard } from '../../guard/index.mjs';
|
|
3
|
+
import { Unreachable } from '../../system/unreachable/unreachable.mjs';
|
|
4
4
|
import { IsLiteral, Literal } from '../types/literal.mjs';
|
|
5
5
|
import { IsBigInt } from '../types/bigint.mjs';
|
|
6
6
|
import { IsBoolean } from '../types/boolean.mjs';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TProperties } from '../types/properties.mjs';
|
|
1
|
+
import { type TProperties } from '../types/properties.mjs';
|
|
2
2
|
export type TResult = TExtendsUnion | TExtendsTrue | TExtendsFalse;
|
|
3
3
|
export interface TExtendsUnion<Inferred extends TProperties = TProperties> {
|
|
4
4
|
'~kind': 'ExtendsUnion';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { IsArray, IsEqual, IsString } from '../../../../guard/guard.mjs';
|
|
1
|
+
export { IsArray, IsEqual, IsString, TakeLeft } from '../../../../guard/guard.mjs';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// deno-coverage-ignore-start - parsebox tested
|
|
2
|
-
export { IsArray, IsEqual, IsString } from '../../../../guard/guard.mjs';
|
|
2
|
+
export { IsArray, IsEqual, IsString, TakeLeft } from '../../../../guard/guard.mjs';
|
|
3
3
|
// ------------------------------------------------------------------
|
|
4
4
|
// Internal Guards to ensure Token is portable.
|
|
5
5
|
// ------------------------------------------------------------------
|
|
@@ -12,15 +12,11 @@ export function Take(variants, input) {
|
|
|
12
12
|
// ----------------------------------------------------------------
|
|
13
13
|
// Symmetric
|
|
14
14
|
// ----------------------------------------------------------------
|
|
15
|
-
//
|
|
16
|
-
//
|
|
17
|
-
//
|
|
18
|
-
//
|
|
19
|
-
//
|
|
20
|
-
// return IsEqual(result.length, 2) ? result : Take(right, input)
|
|
21
|
-
// })()
|
|
22
|
-
// : []
|
|
23
|
-
// ) as never
|
|
15
|
+
// return Guard.TakeLeft(variants, (valueLeft, valueRight) =>
|
|
16
|
+
// Match(TakeVariant(valueLeft, input), (take, rest) =>
|
|
17
|
+
// [take, rest],
|
|
18
|
+
// () => Take(valueRight, input)),
|
|
19
|
+
// () => []) as never
|
|
24
20
|
// ----------------------------------------------------------------
|
|
25
21
|
// Inline
|
|
26
22
|
// ----------------------------------------------------------------
|
|
@@ -1,18 +1,15 @@
|
|
|
1
1
|
// deno-coverage-ignore-start - parsebox tested
|
|
2
2
|
// deno-fmt-ignore-file
|
|
3
3
|
import { Match } from './internal/match.mjs';
|
|
4
|
-
import { IsEqual,
|
|
4
|
+
import { IsEqual, TakeLeft } from './internal/guard.mjs';
|
|
5
5
|
function TakeOne(input) {
|
|
6
6
|
const result = IsEqual(input, '') ? [] : [input.slice(0, 1), input.slice(1)];
|
|
7
7
|
return result;
|
|
8
8
|
}
|
|
9
9
|
function IsInputMatchSentinal(end, input) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
? true
|
|
14
|
-
: IsInputMatchSentinal(right, input)
|
|
15
|
-
: false);
|
|
10
|
+
return TakeLeft(end, (left, right) => input.startsWith(left)
|
|
11
|
+
? true
|
|
12
|
+
: IsInputMatchSentinal(right, input), () => false);
|
|
16
13
|
}
|
|
17
14
|
/** Match Input until but not including End. No match if End not found. */
|
|
18
15
|
export function Until(end, input, result = '') {
|
|
@@ -10,7 +10,8 @@ export interface TArray<Type extends TSchema = TSchema> extends TSchema {
|
|
|
10
10
|
items: Type;
|
|
11
11
|
}
|
|
12
12
|
/** Creates an Array type. */
|
|
13
|
-
export declare function
|
|
13
|
+
export declare function _Array_<Type extends TSchema>(items: Type, options?: TArrayOptions): TArray<Type>;
|
|
14
|
+
export { _Array_ as Array };
|
|
14
15
|
/** Returns true if the given value is a TArray. */
|
|
15
16
|
export declare function IsArray(value: unknown): value is TArray;
|
|
16
17
|
/** Extracts options from a TArray. */
|
|
@@ -5,9 +5,10 @@ import { IsKind } from './schema.mjs';
|
|
|
5
5
|
// Factory
|
|
6
6
|
// ------------------------------------------------------------------
|
|
7
7
|
/** Creates an Array type. */
|
|
8
|
-
export function
|
|
8
|
+
export function _Array_(items, options) {
|
|
9
9
|
return Memory.Create({ '~kind': 'Array' }, { type: 'array', items }, options);
|
|
10
10
|
}
|
|
11
|
+
export { _Array_ as Array }; // Prevent Collision With Global Scope
|
|
11
12
|
// ------------------------------------------------------------------
|
|
12
13
|
// Guard
|
|
13
14
|
// ------------------------------------------------------------------
|
|
@@ -8,7 +8,7 @@ import { IsKind } from './schema.mjs';
|
|
|
8
8
|
export function _Function_(parameters, returnType, options = {}) {
|
|
9
9
|
return Memory.Create({ ['~kind']: 'Function' }, { type: 'function', parameters, returnType }, options);
|
|
10
10
|
}
|
|
11
|
-
export { _Function_ as Function };
|
|
11
|
+
export { _Function_ as Function }; // Prevent Collision With Global Scope
|
|
12
12
|
// ------------------------------------------------------------------
|
|
13
13
|
// Guard
|
|
14
14
|
// ------------------------------------------------------------------
|
|
@@ -11,7 +11,7 @@ export function _Object_(properties, options = {}) {
|
|
|
11
11
|
const required = requiredKeys.length > 0 ? { required: requiredKeys } : {};
|
|
12
12
|
return Memory.Create({ '~kind': 'Object' }, { type: 'object', ...required, properties }, options);
|
|
13
13
|
}
|
|
14
|
-
export { _Object_ as Object }; //
|
|
14
|
+
export { _Object_ as Object }; // Prevent Collision With Global Scope
|
|
15
15
|
// ------------------------------------------------------------------
|
|
16
16
|
// Guard
|
|
17
17
|
// ------------------------------------------------------------------
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { type TProperties, TCyclic } from '../../type/index.mjs';
|
|
1
|
+
import { type TProperties, type TCyclic } from '../../type/index.mjs';
|
|
2
2
|
export declare function FromCyclic(context: TProperties, type: TCyclic, value: unknown): unknown;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { TLiteral, TProperties } from '../../type/index.mjs';
|
|
1
|
+
import { type TLiteral, type TProperties } from '../../type/index.mjs';
|
|
2
2
|
export declare function FromLiteral(context: TProperties, type: TLiteral, value: unknown): unknown;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { TResult } from './try-result.mjs';
|
|
1
|
+
import { type TResult } from './try-result.mjs';
|
|
2
2
|
export declare function TryBigInt(value: unknown): TResult<bigint>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { TResult } from './try-result.mjs';
|
|
1
|
+
import { type TResult } from './try-result.mjs';
|
|
2
2
|
export declare function TryBoolean(value: unknown): TResult<boolean>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { TResult } from './try-result.mjs';
|
|
1
|
+
import { type TResult } from './try-result.mjs';
|
|
2
2
|
export declare function TryNull(value: unknown): TResult<null>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { TResult } from './try-result.mjs';
|
|
1
|
+
import { type TResult } from './try-result.mjs';
|
|
2
2
|
export declare function TryNumber(value: unknown): TResult<number>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { TResult } from './try-result.mjs';
|
|
1
|
+
import { type TResult } from './try-result.mjs';
|
|
2
2
|
export declare function TryString(value: unknown): TResult;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { TResult } from './try-result.mjs';
|
|
1
|
+
import { type TResult } from './try-result.mjs';
|
|
2
2
|
export declare function TryUndefined(value: unknown): TResult<undefined>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { TProperties, TIntersect } from '../../type/index.mjs';
|
|
1
|
+
import { type TProperties, type TIntersect } from '../../type/index.mjs';
|
|
2
2
|
export declare function FromIntersect(context: TProperties, type: TIntersect, value: unknown): unknown;
|