From ef0797a1da1716c759109de70f6c4443b4e2a887 Mon Sep 17 00:00:00 2001 From: sinclair Date: Fri, 5 Jun 2026 12:27:59 +0900 Subject: [PATCH 1/4] Ensure NumericKey Escapes Dot --- deno.jsonc | 2 +- deno.lock | 151 ++++++++++-------- src/type/script/mapping.ts | 6 +- src/type/script/parser.ts | 8 +- src/type/types/number.ts | 2 +- .../runtime/type/engine/action/record.ts | 8 +- .../runtime/type/engine/instantiate.ts | 2 +- test/typebox/runtime/type/script/record.ts | 4 +- .../runtime/type/script/template_literal.ts | 4 +- test/typebox/runtime/value/check/record.ts | 118 ++++++++++++++ 10 files changed, 220 insertions(+), 85 deletions(-) diff --git a/deno.jsonc b/deno.jsonc index 18ea96a8e..1b8287fdc 100644 --- a/deno.jsonc +++ b/deno.jsonc @@ -24,7 +24,7 @@ // Build // -------------------------------------------------------------- "tasksmith": "https://raw.githubusercontent.com/sinclairzx81/tasksmith/0.9.13/src/index.ts", - "parsebox": "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.4/src/index.ts", + "parsebox": "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.5/src/index.ts", // -------------------------------------------------------------- // Test // -------------------------------------------------------------- diff --git a/deno.lock b/deno.lock index 124b5113d..8b5657e00 100644 --- a/deno.lock +++ b/deno.lock @@ -247,71 +247,88 @@ } }, "remote": { - "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.4/src/build/common/comment.ts": "46f86cbd17d0136399d1ff070b8a5a0254ab4654e0b2c2d78146cf9f618190af", - "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.4/src/build/common/escape.ts": "997bf28164a858e05596a373a2215d7eda2047d42a13e4126e0ae4a64c0f19ca", - "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.4/src/build/common/index.ts": "003d952b6585f8eb4402286c186e6f9c252dbaea6fbca1403efe4c44768ac32a", - "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.4/src/build/common/infer.ts": "72658fa012159803732acb593c238bf9a628a66243d3fb8e35247c33e0bf729f", - "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.4/src/build/index.ts": "38248065e5f605baebda02d7517c16c4c79fe0f8edf996fd17d1ec0d95de3fe0", - "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.4/src/build/options.ts": "aed7b1cac13d228ac631f48a8e2b76ac6bf5e3561a1403cca924b01d28ec5e79", - "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.4/src/build/project.ts": "8f43e2ce84b7f97969339c53178270a62b6cb953830672fbd84576c06bcc2f45", - "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.4/src/build/runtime/index.ts": "fcf482eae5b57c20a18b475130aea1288d1ea7a523aa14fba0f17dd6fedfacfd", - "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.4/src/build/runtime/mapping.ts": "38479dcddf5a5df27bca7d137c60f8e4d36bb47e00c0b03ee949d70b9db99b34", - "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.4/src/build/runtime/name.ts": "a1bcbf7f12820363e3bcfc15b2c8fdfa0b3565f9da44604630c3050eee791c6c", - "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.4/src/build/runtime/parse.ts": "9258dcbf6d1a93faeb228b71f92ad476a70fdcf4cd657f0b276c9d1e055a83ba", - "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.4/src/build/static/index.ts": "fcf482eae5b57c20a18b475130aea1288d1ea7a523aa14fba0f17dd6fedfacfd", - "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.4/src/build/static/mapping.ts": "eb7afc1d55542a8c510ecc8312c52d6646acfb194439a9be5cf83457cff23a89", - "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.4/src/build/static/name.ts": "dc7e70b26b9fa5c03c44dec6d3e072fa6b390a3ca394d38bde36c8232d545d0e", - "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.4/src/build/static/parse.ts": "c842c0a468d41256dc4ec17c0a511f580d2565d8cb5a01c584c1621a9c984b22", - "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.4/src/guard/guard.ts": "cf774489f892be19707c0dd87646eec51692bcbe120f8e02752572bb7a757106", - "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.4/src/guard/index.ts": "bdc61533211cd76733a53ad30ea1481aa1db793cdcddc571d2e5821de3add9e7", - "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.4/src/index.ts": "56bc0e30919ae994be4d26be8cd9253fba88f1f6e533a6fb0261341972896017", - "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.4/src/runtime/array.ts": "0399c6e1f9bdb4333522ccd3639d23c9c7cb9c6bad969b086519aad79fd0ba34", - "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.4/src/runtime/bigint.ts": "de53745d883b5530fe7aa4c27072df206086cbcf0a488db0e1756d4798cacf75", - "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.4/src/runtime/const.ts": "da60de496ad00ad44771c1ec99e700ec756970f65aa25b0767a1d322f6ecfe09", - "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.4/src/runtime/ident.ts": "305af317e88cd14613b53a183d4346b792ab1c8624e7e811186df0abfa703253", - "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.4/src/runtime/index.ts": "13c454f3ca11e366878524385094cde5057090cca870ba9255a0c00a494acc72", - "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.4/src/runtime/integer.ts": "0f36538398946c10b4efea4e2ba96cf8b9014b2926f760cdd5088f3755741e2b", - "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.4/src/runtime/module.ts": "39eeb1964d5ae7eef1647cd118fe6f7802835f98f58760b741c162c447ab06af", - "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.4/src/runtime/number.ts": "c546607889e6ddf5fb14fb25f7d76a57dac2e018e6f1bd9bccf0aaa2ac2eeb46", - "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.4/src/runtime/optional.ts": "0ef2e6559c44cad9602a0ef462ed6c355fde3cd668608d31bac04dda590f44d9", - "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.4/src/runtime/parse.ts": "05fc7c1755515eb4c61c75ef1391e88703fb1ffc4f681e49d05dd75f98ca30e8", - "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.4/src/runtime/parser.ts": "6a055a3cee103ac97f5f34190e37b19486fd0582f2ba986a0e1702dbd8af25c6", - "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.4/src/runtime/ref.ts": "205ec999c4a8dd2b1ad2583de5ba14aa68b680abdb3613ab05356d1d29a72161", - "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.4/src/runtime/rest.ts": "816358555ef63df044e72165d4ec273af50824d40a41df3aadf5d5a69f051308", - "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.4/src/runtime/static.ts": "529de34e5066b0fe77ea1a897f8cc897a8cbca38ea4486fe091a78dd4312a027", - "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.4/src/runtime/string.ts": "b772842925123ce442b310a672882a6dff08e2f8f1329518a517ae19be3ba41c", - "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.4/src/runtime/tuple.ts": "bc85d92ef500498c8b2c381362430cea453065bc9717dd2d48380b5190621dda", - "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.4/src/runtime/union.ts": "cfed43fa446e91e585797c033d61c9a598ac161cec5466ff64a97455c6483980", - "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.4/src/runtime/unsigned_integer.ts": "a355886ffdf1e6c3bceced267209aeb3093d454965e9df1f143d2c446085e148", - "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.4/src/runtime/unsigned_number.ts": "09417d49c4e55ba37da63cc346720d777e3ef7e152a5d8d62ae27b3dc9b5b1b4", - "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.4/src/runtime/until.ts": "38b5b28673cb5d853d4cf5fd34278fbdaed8b73997b244301263f7bd3ea9aa16", - "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.4/src/runtime/until_1.ts": "9a5e6db98bb5d562c8b16c34b569d2daa7da395ccf644b9eac148484caa15758", - "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.4/src/static/index.ts": "a28f438f767d394128e66dc2fcc39dcd684047c51b0d353082463576be7c3f46", - "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.4/src/system/arguments/arguments.ts": "38faa50184aaefccf5e4e6d09fd2836b8f54d4e77a974e4033eec4d4e5eec391", - "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.4/src/system/arguments/index.ts": "aa4acde7e517e6426607c8cacd9c0b31247423176deea8e5bb6de7b9fa808a31", - "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.4/src/system/index.ts": "502ab5957e2cb4e0a83359d1b8facfe531b6024692aa03da80194d3645322230", - "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.4/src/system/unreachable/index.ts": "ff74d42af2568398b4582ebcac4370bea5925734465bb04ffbbc26ade7627595", - "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.4/src/system/unreachable/unreachable.ts": "b51e28a281c0e8c265456f02ca37369383d1748467a0657b9d3aac55221a32cd", - "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.4/src/token/bigint.ts": "bd3d2e184998349a715d116e6f5e451900f628f502b856ea5e74003654256086", - "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.4/src/token/const.ts": "c73bbbd2e05a30c62896fa3116e590b12a66c1a819dfdd1a7fab634f5f8b7116", - "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.4/src/token/ident.ts": "3e3ca12aa351e548cf0dd8ba8fe302e069c15870f2b87cd3ac62611ee44c5cde", - "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.4/src/token/index.ts": "1b532e4020926dfcd94abf1ae7d06a6d7d90892121b1d500519167e50b4389a2", - "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.4/src/token/integer.ts": "0e4ae7db5c8239da95752bddd6c47b7658ff12d8b24d027767f89fd98fc98ae7", - "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.4/src/token/internal/char.ts": "b4359662e9110c827d76ec4bcd00f6c2725917ac4184124aa6a57147649efd76", - "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.4/src/token/internal/guard.ts": "5667e98538d77fb93b4868f870674d46c5d405c99f07360afa8b90bb318ec515", - "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.4/src/token/internal/many.ts": "763b1a7794e50a2f5830effbb8becf72d0e170588ca158c9447756c6665574fd", - "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.4/src/token/internal/match.ts": "dfe9ddce3db4b40ba343198bad3c6d8c108cc55f4e3995b2925139f2ce56846c", - "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.4/src/token/internal/optional.ts": "0b4165857a3831f2408b6750a7391d0985920bee42f36a4395057f9c9541df11", - "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.4/src/token/internal/take.ts": "ac7f7eb2ad2687aacf5e08bd26ca986647bb619026ee1146c8305ecddf01c1a2", - "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.4/src/token/internal/trim.ts": "5edc535121afb01a9c396fa5335c6c4b0e8fb97e61553c85be22f3cada3b7cce", - "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.4/src/token/number.ts": "0d0ada85800860ab3991aeca7160909e61b93822748e95967b22b41983ffa9e3", - "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.4/src/token/rest.ts": "0a995780577f64b3a05dea6517d2e8c0bb068a740d433df053767e464b1bc321", - "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.4/src/token/span.ts": "7080804017ca46f6cb0ff01f7ffe6af91e11743c5b010a0f5fb369c8110a595a", - "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.4/src/token/string.ts": "a6618b18da475ed90752789e280c5e29b1da7f502fbcdcef67800e12e2bec8b2", - "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.4/src/token/unsigned_integer.ts": "ffc29b85b54870fa6d837c739ed9ec7df567ceb48522fdc5776876af2406ad25", - "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.4/src/token/unsigned_number.ts": "e6466cbeff9fe0c3a8c24cf0b2ad3063e42643613b6ad0612cb730a27fd1ebb3", - "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.4/src/token/until.ts": "4f99f8402608dae0044cf2bb325321492e072d4a7374e60d5bd5a126f89f2b21", - "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.4/src/token/until_1.ts": "c9a6892fcbcd75c0fe0676f1a28d735c0f454d0401b4cbe8c476a074e5e24aa5", + "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.5/src/build/common/comment.ts": "46f86cbd17d0136399d1ff070b8a5a0254ab4654e0b2c2d78146cf9f618190af", + "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.5/src/build/common/escape.ts": "51a34baeffc0a0e148e7a8442806655c8b1b58a1a662dd1cdc1e744a43f9ff0c", + "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.5/src/build/common/index.ts": "003d952b6585f8eb4402286c186e6f9c252dbaea6fbca1403efe4c44768ac32a", + "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.5/src/build/common/infer.ts": "8c7416622a09733cd927726aabc9325a50225cfc21d616ad6e713d8fd70a47cf", + "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.5/src/build/index.ts": "38248065e5f605baebda02d7517c16c4c79fe0f8edf996fd17d1ec0d95de3fe0", + "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.5/src/build/options.ts": "aed7b1cac13d228ac631f48a8e2b76ac6bf5e3561a1403cca924b01d28ec5e79", + "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.5/src/build/project.ts": "8f43e2ce84b7f97969339c53178270a62b6cb953830672fbd84576c06bcc2f45", + "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.5/src/build/runtime/index.ts": "fcf482eae5b57c20a18b475130aea1288d1ea7a523aa14fba0f17dd6fedfacfd", + "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.5/src/build/runtime/mapping.ts": "38479dcddf5a5df27bca7d137c60f8e4d36bb47e00c0b03ee949d70b9db99b34", + "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.5/src/build/runtime/name.ts": "a1bcbf7f12820363e3bcfc15b2c8fdfa0b3565f9da44604630c3050eee791c6c", + "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.5/src/build/runtime/parse.ts": "9258dcbf6d1a93faeb228b71f92ad476a70fdcf4cd657f0b276c9d1e055a83ba", + "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.5/src/build/static/index.ts": "fcf482eae5b57c20a18b475130aea1288d1ea7a523aa14fba0f17dd6fedfacfd", + "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.5/src/build/static/mapping.ts": "eb7afc1d55542a8c510ecc8312c52d6646acfb194439a9be5cf83457cff23a89", + "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.5/src/build/static/name.ts": "dc7e70b26b9fa5c03c44dec6d3e072fa6b390a3ca394d38bde36c8232d545d0e", + "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.5/src/build/static/parse.ts": "c842c0a468d41256dc4ec17c0a511f580d2565d8cb5a01c584c1621a9c984b22", + "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.5/src/guard/guard.ts": "cf774489f892be19707c0dd87646eec51692bcbe120f8e02752572bb7a757106", + "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.5/src/guard/index.ts": "bdc61533211cd76733a53ad30ea1481aa1db793cdcddc571d2e5821de3add9e7", + "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.5/src/index.ts": "56bc0e30919ae994be4d26be8cd9253fba88f1f6e533a6fb0261341972896017", + "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.5/src/runtime/array.ts": "0399c6e1f9bdb4333522ccd3639d23c9c7cb9c6bad969b086519aad79fd0ba34", + "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.5/src/runtime/bigint.ts": "de53745d883b5530fe7aa4c27072df206086cbcf0a488db0e1756d4798cacf75", + "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.5/src/runtime/const.ts": "da60de496ad00ad44771c1ec99e700ec756970f65aa25b0767a1d322f6ecfe09", + "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.5/src/runtime/ident.ts": "305af317e88cd14613b53a183d4346b792ab1c8624e7e811186df0abfa703253", + "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.5/src/runtime/index.ts": "13c454f3ca11e366878524385094cde5057090cca870ba9255a0c00a494acc72", + "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.5/src/runtime/integer.ts": "0f36538398946c10b4efea4e2ba96cf8b9014b2926f760cdd5088f3755741e2b", + "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.5/src/runtime/module.ts": "39eeb1964d5ae7eef1647cd118fe6f7802835f98f58760b741c162c447ab06af", + "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.5/src/runtime/number.ts": "c546607889e6ddf5fb14fb25f7d76a57dac2e018e6f1bd9bccf0aaa2ac2eeb46", + "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.5/src/runtime/optional.ts": "0ef2e6559c44cad9602a0ef462ed6c355fde3cd668608d31bac04dda590f44d9", + "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.5/src/runtime/parse.ts": "05fc7c1755515eb4c61c75ef1391e88703fb1ffc4f681e49d05dd75f98ca30e8", + "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.5/src/runtime/parser.ts": "6a055a3cee103ac97f5f34190e37b19486fd0582f2ba986a0e1702dbd8af25c6", + "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.5/src/runtime/ref.ts": "205ec999c4a8dd2b1ad2583de5ba14aa68b680abdb3613ab05356d1d29a72161", + "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.5/src/runtime/rest.ts": "816358555ef63df044e72165d4ec273af50824d40a41df3aadf5d5a69f051308", + "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.5/src/runtime/static.ts": "529de34e5066b0fe77ea1a897f8cc897a8cbca38ea4486fe091a78dd4312a027", + "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.5/src/runtime/string.ts": "b772842925123ce442b310a672882a6dff08e2f8f1329518a517ae19be3ba41c", + "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.5/src/runtime/tuple.ts": "bc85d92ef500498c8b2c381362430cea453065bc9717dd2d48380b5190621dda", + "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.5/src/runtime/union.ts": "cfed43fa446e91e585797c033d61c9a598ac161cec5466ff64a97455c6483980", + "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.5/src/runtime/unsigned_integer.ts": "a355886ffdf1e6c3bceced267209aeb3093d454965e9df1f143d2c446085e148", + "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.5/src/runtime/unsigned_number.ts": "09417d49c4e55ba37da63cc346720d777e3ef7e152a5d8d62ae27b3dc9b5b1b4", + "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.5/src/runtime/until.ts": "38b5b28673cb5d853d4cf5fd34278fbdaed8b73997b244301263f7bd3ea9aa16", + "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.5/src/runtime/until_1.ts": "9a5e6db98bb5d562c8b16c34b569d2daa7da395ccf644b9eac148484caa15758", + "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.5/src/static/array.ts": "7db16109b7ad7945685b347f1613160adb589835b877d6d9e3e9078b85ed7def", + "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.5/src/static/bigint.ts": "43b0e648887db9887b9601eeea1aa2ca3d5d2a424d313075bcffcaf44c3eccf1", + "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.5/src/static/const.ts": "8b8edfd9ed53094610d7c27c7a9bb968cba4701b60f8ad22d9649df26757d9b2", + "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.5/src/static/ident.ts": "9aa66f47ca66cd011ed78376dfb3c61375e19b77ff67f6b576db1ab79694c130", + "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.5/src/static/index.ts": "a28f438f767d394128e66dc2fcc39dcd684047c51b0d353082463576be7c3f46", + "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.5/src/static/integer.ts": "b097fc27476c754cbd1eaaed8fa273c85fc08027e1bdaab2bc048b5a2d17d20f", + "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.5/src/static/number.ts": "9e21af3ef52ea6cc05036d4ac9ab54f694ee27680c90c1ee2f7abf226ee4bc6e", + "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.5/src/static/optional.ts": "9a08fcf4feac08209b8343fbc88a74ade030742b1ffcceaabd5aee13aa0e5f08", + "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.5/src/static/parse.ts": "bebb2550f751a04121de8e8697ae78073ca183b9ffc8b1694634d6ffa7ca9508", + "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.5/src/static/parser.ts": "196cc6ed32e473ece7ff7ec24b2ad2260124aa069698eea961962071fe5c4303", + "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.5/src/static/rest.ts": "f6b1e28f6ce5ac4af613bde4168dd7d52b81c1e7a3248b06a89f67535e87c966", + "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.5/src/static/string.ts": "a703d46b89173ddb1a41f4d6b5047ac389151310a7e822771dad5b57871ef9aa", + "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.5/src/static/tuple.ts": "2d1f1c61134a6e148223a882c1e8b88a1f828fddf631c5e9f9348a10ea91f652", + "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.5/src/static/union.ts": "6aef26502d2dd49ac450d98dbb58bac1e707dc6f44efbd34b7661c74ee05f25d", + "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.5/src/static/unsigned_integer.ts": "2df3e32b6babf97baa0f266b2303613673a91a821c82637cc3489f62c6df4d5c", + "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.5/src/static/unsigned_number.ts": "7af2970db601da54bc8c2813e6fe32ebc15b6943786a6ab51879673b4a6bae11", + "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.5/src/static/until.ts": "8512647659c0cc283d10d49fc24315dd4c7ce734108c71d12661ea0d665df116", + "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.5/src/static/until_1.ts": "1195f1cff31c7cefedbdaa30f5fe1f58d872da5575ec64f19f09488bcdd6c5f2", + "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.5/src/system/arguments/arguments.ts": "38faa50184aaefccf5e4e6d09fd2836b8f54d4e77a974e4033eec4d4e5eec391", + "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.5/src/system/arguments/index.ts": "aa4acde7e517e6426607c8cacd9c0b31247423176deea8e5bb6de7b9fa808a31", + "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.5/src/system/index.ts": "502ab5957e2cb4e0a83359d1b8facfe531b6024692aa03da80194d3645322230", + "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.5/src/system/unreachable/index.ts": "ff74d42af2568398b4582ebcac4370bea5925734465bb04ffbbc26ade7627595", + "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.5/src/system/unreachable/unreachable.ts": "b51e28a281c0e8c265456f02ca37369383d1748467a0657b9d3aac55221a32cd", + "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.5/src/token/bigint.ts": "bd3d2e184998349a715d116e6f5e451900f628f502b856ea5e74003654256086", + "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.5/src/token/const.ts": "c73bbbd2e05a30c62896fa3116e590b12a66c1a819dfdd1a7fab634f5f8b7116", + "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.5/src/token/ident.ts": "3e3ca12aa351e548cf0dd8ba8fe302e069c15870f2b87cd3ac62611ee44c5cde", + "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.5/src/token/index.ts": "1b532e4020926dfcd94abf1ae7d06a6d7d90892121b1d500519167e50b4389a2", + "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.5/src/token/integer.ts": "0e4ae7db5c8239da95752bddd6c47b7658ff12d8b24d027767f89fd98fc98ae7", + "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.5/src/token/internal/char.ts": "b4359662e9110c827d76ec4bcd00f6c2725917ac4184124aa6a57147649efd76", + "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.5/src/token/internal/guard.ts": "5667e98538d77fb93b4868f870674d46c5d405c99f07360afa8b90bb318ec515", + "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.5/src/token/internal/many.ts": "763b1a7794e50a2f5830effbb8becf72d0e170588ca158c9447756c6665574fd", + "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.5/src/token/internal/match.ts": "dfe9ddce3db4b40ba343198bad3c6d8c108cc55f4e3995b2925139f2ce56846c", + "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.5/src/token/internal/optional.ts": "0b4165857a3831f2408b6750a7391d0985920bee42f36a4395057f9c9541df11", + "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.5/src/token/internal/take.ts": "ac7f7eb2ad2687aacf5e08bd26ca986647bb619026ee1146c8305ecddf01c1a2", + "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.5/src/token/internal/trim.ts": "5edc535121afb01a9c396fa5335c6c4b0e8fb97e61553c85be22f3cada3b7cce", + "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.5/src/token/number.ts": "0d0ada85800860ab3991aeca7160909e61b93822748e95967b22b41983ffa9e3", + "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.5/src/token/rest.ts": "0a995780577f64b3a05dea6517d2e8c0bb068a740d433df053767e464b1bc321", + "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.5/src/token/span.ts": "7080804017ca46f6cb0ff01f7ffe6af91e11743c5b010a0f5fb369c8110a595a", + "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.5/src/token/string.ts": "a6618b18da475ed90752789e280c5e29b1da7f502fbcdcef67800e12e2bec8b2", + "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.5/src/token/unsigned_integer.ts": "ffc29b85b54870fa6d837c739ed9ec7df567ceb48522fdc5776876af2406ad25", + "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.5/src/token/unsigned_number.ts": "e6466cbeff9fe0c3a8c24cf0b2ad3063e42643613b6ad0612cb730a27fd1ebb3", + "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.5/src/token/until.ts": "4f99f8402608dae0044cf2bb325321492e072d4a7374e60d5bd5a126f89f2b21", + "https://raw.githubusercontent.com/sinclairzx81/parsebox/0.11.5/src/token/until_1.ts": "c9a6892fcbcd75c0fe0676f1a28d735c0f454d0401b4cbe8c476a074e5e24aa5", "https://raw.githubusercontent.com/sinclairzx81/tasksmith/0.9.13/src/attw/attw.ts": "d8da3257f0ffd2b9347de5632f871b2aab7f297fd68c523dc57c24dc45b2e3cf", "https://raw.githubusercontent.com/sinclairzx81/tasksmith/0.9.13/src/attw/index.ts": "a76b99adbfaee3416ea98f2a5908b76c846e0fbf0768876ed93d1e8aa21a8cff", "https://raw.githubusercontent.com/sinclairzx81/tasksmith/0.9.13/src/browser/browser.ts": "42b3060763be9ce26b262ddf4a80b570319a1c511be39a5403e1f95b098b5589", @@ -333,6 +350,7 @@ "https://raw.githubusercontent.com/sinclairzx81/tasksmith/0.9.13/src/build/esm/esm.ts": "00ce41d3b48526148e706477fade3d19e02e2826dc7a3aa34f9c0c824993b092", "https://raw.githubusercontent.com/sinclairzx81/tasksmith/0.9.13/src/build/esm/folder.ts": "90576e23137a57677ed7a7dc994e49f1feb0f40a7507b5422168c7f143777cca", "https://raw.githubusercontent.com/sinclairzx81/tasksmith/0.9.13/src/build/index.ts": "d0f163948e4e8b56451a0fd1e137bcf1b74440ea213335443c9abd38a6d1f3cb", + "https://raw.githubusercontent.com/sinclairzx81/tasksmith/0.9.13/src/build/options.ts": "3849cd3144e482197b3bcfe5e325340be8cf62abae20b66140b62081d0501648", "https://raw.githubusercontent.com/sinclairzx81/tasksmith/0.9.13/src/compress/compress.ts": "04389003328eb5a94c32e3044ca45a4bc2730059437464afe732535cbc9424dd", "https://raw.githubusercontent.com/sinclairzx81/tasksmith/0.9.13/src/compress/format-size.ts": "e05a7e2ed57d4addcbc517dd92ff90d9e1fb7df3c7cc437b7658ff59cf0a36a3", "https://raw.githubusercontent.com/sinclairzx81/tasksmith/0.9.13/src/compress/gzip-size.ts": "ef05ca63af0a952f4f993e97dbaceb4549ce26353521caa8abcc9f4e7dc63ca0", @@ -376,8 +394,7 @@ "https://raw.githubusercontent.com/sinclairzx81/tasksmith/0.9.13/src/test/test.ts": "894650a3af2f7c0c8e4e4f0930d6f3e7bfc5187c5c66ce869c0429b942a51c2d", "https://raw.githubusercontent.com/sinclairzx81/tasksmith/0.9.13/src/tsc/index.ts": "641df70d43bb590e3cb0739abd3b788993127e67b3ef7ed3535cf97b240a4bc4", "https://raw.githubusercontent.com/sinclairzx81/tasksmith/0.9.13/src/tsc/tsc.ts": "e80a43b562a741bc4ba0b8f99c10be02ee4e3a89771faa14d39139ece45d2b67", - "https://raw.githubusercontent.com/sinclairzx81/tasksmith/0.9.13/src/tsc/tsgo.ts": "0db96f9c9c06b06bd96e3b3552d38a1716c174bd1ce9d4fe7f104403094a50b5", - "https://raw.githubusercontent.com/sinclairzx81/tasksmith/0.9.9/src/build/dual/folder.ts": "90576e23137a57677ed7a7dc994e49f1feb0f40a7507b5422168c7f143777cca" + "https://raw.githubusercontent.com/sinclairzx81/tasksmith/0.9.13/src/tsc/tsgo.ts": "0db96f9c9c06b06bd96e3b3552d38a1716c174bd1ce9d4fe7f104403094a50b5" }, "workspace": { "dependencies": [ diff --git a/src/type/script/mapping.ts b/src/type/script/mapping.ts index 88a75c514..bac206d97 100644 --- a/src/type/script/mapping.ts +++ b/src/type/script/mapping.ts @@ -1356,12 +1356,12 @@ export function PatternStringMapping(input: '.*'): unknown { return T.String() } // ------------------------------------------------------------------- -// PatternNumber: '-?(?:0|[1-9][0-9]*)(?:.[0-9]+)?' +// PatternNumber: '-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?' // ------------------------------------------------------------------- -export type TPatternNumberMapping = ( +export type TPatternNumberMapping = ( T.TNumber ) -export function PatternNumberMapping(input: '-?(?:0|[1-9][0-9]*)(?:.[0-9]+)?'): unknown { +export function PatternNumberMapping(input: '-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?'): unknown { return T.Number() } // ------------------------------------------------------------------- diff --git a/src/type/script/parser.ts b/src/type/script/parser.ts index f208d4677..80f7f1d55 100644 --- a/src/type/script/parser.ts +++ b/src/type/script/parser.ts @@ -139,10 +139,10 @@ export type TJsonArray = (Token.TConst<'[', Input> extends export type TJson = (TJsonNumber extends [infer _0, infer Input extends string] ? [_0, Input] : TJsonBoolean extends [infer _0, infer Input extends string] ? [_0, Input] : TJsonString extends [infer _0, infer Input extends string] ? [_0, Input] : TJsonNull extends [infer _0, infer Input extends string] ? [_0, Input] : TJsonObject extends [infer _0, infer Input extends string] ? [_0, Input] : TJsonArray extends [infer _0, infer Input extends string] ? [_0, Input] : []) extends [infer _0 extends unknown, infer Input extends string] ? [S.TJsonMapping<_0>, Input] : [] export type TPatternBigInt = Token.TConst<'-?(?:0|[1-9][0-9]*)n', Input> extends [infer _0 extends '-?(?:0|[1-9][0-9]*)n', infer Input extends string] ? [S.TPatternBigIntMapping<_0>, Input] : [] export type TPatternString = Token.TConst<'.*', Input> extends [infer _0 extends '.*', infer Input extends string] ? [S.TPatternStringMapping<_0>, Input] : [] -export type TPatternNumber = Token.TConst<'-?(?:0|[1-9][0-9]*)(?:.[0-9]+)?', Input> extends [infer _0 extends '-?(?:0|[1-9][0-9]*)(?:.[0-9]+)?', infer Input extends string] ? [S.TPatternNumberMapping<_0>, Input] : [] +export type TPatternNumber = Token.TConst<'-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?', Input> extends [infer _0 extends '-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?', infer Input extends string] ? [S.TPatternNumberMapping<_0>, Input] : [] export type TPatternInteger = Token.TConst<'-?(?:0|[1-9][0-9]*)', Input> extends [infer _0 extends '-?(?:0|[1-9][0-9]*)', infer Input extends string] ? [S.TPatternIntegerMapping<_0>, Input] : [] export type TPatternNever = Token.TConst<'(?!)', Input> extends [infer _0 extends '(?!)', infer Input extends string] ? [S.TPatternNeverMapping<_0>, Input] : [] -export type TPatternText = Token.TUntil_1<['-?(?:0|[1-9][0-9]*)n', '.*', '-?(?:0|[1-9][0-9]*)(?:.[0-9]+)?', '-?(?:0|[1-9][0-9]*)', '(?!)', '(', ')', '$', '|'], Input> extends [infer _0 extends string, infer Input extends string] ? [S.TPatternTextMapping<_0>, Input] : [] +export type TPatternText = Token.TUntil_1<['-?(?:0|[1-9][0-9]*)n', '.*', '-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?', '-?(?:0|[1-9][0-9]*)', '(?!)', '(', ')', '$', '|'], Input> extends [infer _0 extends string, infer Input extends string] ? [S.TPatternTextMapping<_0>, Input] : [] export type TPatternBase = (TPatternBigInt extends [infer _0, infer Input extends string] ? [_0, Input] : TPatternString extends [infer _0, infer Input extends string] ? [_0, Input] : TPatternNumber extends [infer _0, infer Input extends string] ? [_0, Input] : TPatternInteger extends [infer _0, infer Input extends string] ? [_0, Input] : TPatternNever extends [infer _0, infer Input extends string] ? [_0, Input] : TPatternGroup extends [infer _0, infer Input extends string] ? [_0, Input] : TPatternText extends [infer _0, infer Input extends string] ? [_0, Input] : []) extends [infer _0 extends unknown, infer Input extends string] ? [S.TPatternBaseMapping<_0>, Input] : [] export type TPatternGroup = (Token.TConst<'(', Input> extends [infer _0, infer Input extends string] ? (TPatternBody extends [infer _1, infer Input extends string] ? (Token.TConst<')', Input> extends [infer _2, infer Input extends string] ? [[_0, _1, _2], Input] : []) : []) : []) extends [infer _0 extends [unknown, unknown, unknown], infer Input extends string] ? [S.TPatternGroupMapping<_0>, Input] : [] export type TPatternUnion = ((TPatternTerm extends [infer _0, infer Input extends string] ? (Token.TConst<'|', Input> extends [infer _1, infer Input extends string] ? (TPatternUnion extends [infer _2, infer Input extends string] ? [[_0, _1, _2], Input] : []) : []) : []) extends [infer _0, infer Input extends string] ? [_0, Input] : (TPatternTerm extends [infer _0, infer Input extends string] ? [[_0], Input] : []) extends [infer _0, infer Input extends string] ? [_0, Input] : [[], Input] extends [infer _0, infer Input extends string] ? [_0, Input] : []) extends [infer _0 extends [unknown, unknown, unknown] | [unknown] | [], infer Input extends string] ? [S.TPatternUnionMapping<_0>, Input] : [] @@ -271,10 +271,10 @@ export const JsonArray = (input: string): [unknown, string] | [] => If(If(Token. export const Json = (input: string): [unknown, string] | [] => If(If(JsonNumber(input), ([_0, input]) => [_0, input], () => If(JsonBoolean(input), ([_0, input]) => [_0, input], () => If(JsonString(input), ([_0, input]) => [_0, input], () => If(JsonNull(input), ([_0, input]) => [_0, input], () => If(JsonObject(input), ([_0, input]) => [_0, input], () => If(JsonArray(input), ([_0, input]) => [_0, input], () => [])))))), ([_0, input]) => [S.JsonMapping(_0 as unknown), input]) export const PatternBigInt = (input: string): [unknown, string] | [] => If(Token.Const('-?(?:0|[1-9][0-9]*)n', input), ([_0, input]) => [S.PatternBigIntMapping(_0 as '-?(?:0|[1-9][0-9]*)n'), input]) export const PatternString = (input: string): [unknown, string] | [] => If(Token.Const('.*', input), ([_0, input]) => [S.PatternStringMapping(_0 as '.*'), input]) -export const PatternNumber = (input: string): [unknown, string] | [] => If(Token.Const('-?(?:0|[1-9][0-9]*)(?:.[0-9]+)?', input), ([_0, input]) => [S.PatternNumberMapping(_0 as '-?(?:0|[1-9][0-9]*)(?:.[0-9]+)?'), input]) +export const PatternNumber = (input: string): [unknown, string] | [] => If(Token.Const('-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?', input), ([_0, input]) => [S.PatternNumberMapping(_0 as '-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?'), input]) export const PatternInteger = (input: string): [unknown, string] | [] => If(Token.Const('-?(?:0|[1-9][0-9]*)', input), ([_0, input]) => [S.PatternIntegerMapping(_0 as '-?(?:0|[1-9][0-9]*)'), input]) export const PatternNever = (input: string): [unknown, string] | [] => If(Token.Const('(?!)', input), ([_0, input]) => [S.PatternNeverMapping(_0 as '(?!)'), input]) -export const PatternText = (input: string): [unknown, string] | [] => If(Token.Until_1(['-?(?:0|[1-9][0-9]*)n', '.*', '-?(?:0|[1-9][0-9]*)(?:.[0-9]+)?', '-?(?:0|[1-9][0-9]*)', '(?!)', '(', ')', '$', '|'], input), ([_0, input]) => [S.PatternTextMapping(_0 as string), input]) +export const PatternText = (input: string): [unknown, string] | [] => If(Token.Until_1(['-?(?:0|[1-9][0-9]*)n', '.*', '-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?', '-?(?:0|[1-9][0-9]*)', '(?!)', '(', ')', '$', '|'], input), ([_0, input]) => [S.PatternTextMapping(_0 as string), input]) export const PatternBase = (input: string): [unknown, string] | [] => If(If(PatternBigInt(input), ([_0, input]) => [_0, input], () => If(PatternString(input), ([_0, input]) => [_0, input], () => If(PatternNumber(input), ([_0, input]) => [_0, input], () => If(PatternInteger(input), ([_0, input]) => [_0, input], () => If(PatternNever(input), ([_0, input]) => [_0, input], () => If(PatternGroup(input), ([_0, input]) => [_0, input], () => If(PatternText(input), ([_0, input]) => [_0, input], () => []))))))), ([_0, input]) => [S.PatternBaseMapping(_0 as unknown), input]) export const PatternGroup = (input: string): [unknown, string] | [] => If(If(Token.Const('(', input), ([_0, input]) => If(PatternBody(input), ([_1, input]) => If(Token.Const(')', input), ([_2, input]) => [[_0, _1, _2], input]))), ([_0, input]) => [S.PatternGroupMapping(_0 as [unknown, unknown, unknown]), input]) export const PatternUnion = (input: string): [unknown, string] | [] => If(If(If(PatternTerm(input), ([_0, input]) => If(Token.Const('|', input), ([_1, input]) => If(PatternUnion(input), ([_2, input]) => [[_0, _1, _2], input]))), ([_0, input]) => [_0, input], () => If(If(PatternTerm(input), ([_0, input]) => [[_0], input]), ([_0, input]) => [_0, input], () => If([[], input], ([_0, input]) => [_0, input], () => []))), ([_0, input]) => [S.PatternUnionMapping(_0 as [unknown, unknown, unknown] | [unknown] | []), input]) diff --git a/src/type/types/number.ts b/src/type/types/number.ts index 103c0e24c..6bdbb1846 100644 --- a/src/type/types/number.ts +++ b/src/type/types/number.ts @@ -34,7 +34,7 @@ import { type TSchema, type TNumberOptions, IsKind } from './schema.ts' // ------------------------------------------------------------------ // Pattern // ------------------------------------------------------------------ -export const NumberPattern = '-?(?:0|[1-9][0-9]*)(?:\.[0-9]+)?' +export const NumberPattern = '-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?' // ------------------------------------------------------------------ // Static // ------------------------------------------------------------------ diff --git a/test/typebox/runtime/type/engine/action/record.ts b/test/typebox/runtime/type/engine/action/record.ts index 7300b5643..93212a3bb 100644 --- a/test/typebox/runtime/type/engine/action/record.ts +++ b/test/typebox/runtime/type/engine/action/record.ts @@ -37,8 +37,8 @@ Test('Should Record 4', () => { Assert.IsTrue(Type.IsInteger(Type.RecordKey(T))) }) Test('Should Record 5', () => { - const T: Type.TRecord<'^-?(?:0|[1-9][0-9]*)(?:.[0-9]+)?$', Type.TNull> = Type.Record(Type.Number(), Type.Null()) - Assert.IsEqual(Type.RecordPattern(T), '^-?(?:0|[1-9][0-9]*)(?:.[0-9]+)?$') + const T: Type.TRecord<'^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$', Type.TNull> = Type.Record(Type.Number(), Type.Null()) + Assert.IsEqual(Type.RecordPattern(T), '^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$') Assert.IsTrue(Type.IsNumber(Type.RecordKey(T))) }) Test('Should Record 6', () => { @@ -189,8 +189,8 @@ Test('Should Record 20', () => { // Key: Number // ------------------------------------------------------------------ Test('Should Record 21', () => { - const T: Type.TRecord<'^-?(?:0|[1-9][0-9]*)(?:.[0-9]+)?$', Type.TNull> = Type.Record(Type.Number(), Type.Null()) - Assert.IsEqual(Type.RecordPattern(T), '^-?(?:0|[1-9][0-9]*)(?:.[0-9]+)?$') + const T: Type.TRecord<'^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$', Type.TNull> = Type.Record(Type.Number(), Type.Null()) + Assert.IsEqual(Type.RecordPattern(T), '^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$') Assert.IsTrue(Type.IsRecord(T)) Assert.IsTrue(Type.IsNumber(Type.RecordKey(T))) diff --git a/test/typebox/runtime/type/engine/instantiate.ts b/test/typebox/runtime/type/engine/instantiate.ts index d6df3939a..5f7dd3185 100644 --- a/test/typebox/runtime/type/engine/instantiate.ts +++ b/test/typebox/runtime/type/engine/instantiate.ts @@ -218,7 +218,7 @@ Test('Should Instantiate 34', () => { Assert.IsEqual(A.properties.y.$ref, 'B') }) Test('Should Instantiate 35', () => { - const A: Type.TRecord<'^-?(?:0|[1-9][0-9]*)(?:.[0-9]+)?$', Type.TRef<'B'>> = Type.Instantiate({ A: Type.Number() }, Type.Record(Type.Ref('A'), Type.Ref('B'))) + const A: Type.TRecord<'^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$', Type.TRef<'B'>> = Type.Instantiate({ A: Type.Number() }, Type.Record(Type.Ref('A'), Type.Ref('B'))) Assert.IsTrue(Type.IsRecord(A)) Assert.IsTrue(Type.IsNumber(Type.RecordKey(A))) Assert.IsTrue(Type.IsRef(Type.RecordValue(A))) diff --git a/test/typebox/runtime/type/script/record.ts b/test/typebox/runtime/type/script/record.ts index 1e285b844..3e56366ff 100644 --- a/test/typebox/runtime/type/script/record.ts +++ b/test/typebox/runtime/type/script/record.ts @@ -108,9 +108,9 @@ Test('Should Record 15', () => { Assert.IsEqual(Type.RecordPattern(T), '^-?(?:0|[1-9][0-9]*)$') }) Test('Should Record 16', () => { - const T: Type.TRecord<'^-?(?:0|[1-9][0-9]*)(?:.[0-9]+)?$', Type.TString> = Type.Script('Record<`${number}`, string>') + const T: Type.TRecord<'^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$', Type.TString> = Type.Script('Record<`${number}`, string>') Assert.IsTrue(Type.IsRecord(T)) - Assert.IsEqual(Type.RecordPattern(T), '^-?(?:0|[1-9][0-9]*)(?:.[0-9]+)?$') + Assert.IsEqual(Type.RecordPattern(T), '^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$') }) Test('Should Record 17', () => { const T: Type.TRecord<'^(?!)$', Type.TString> = Type.Script('Record<`${never}`, string>') diff --git a/test/typebox/runtime/type/script/template_literal.ts b/test/typebox/runtime/type/script/template_literal.ts index d05f8a823..c856a35f0 100644 --- a/test/typebox/runtime/type/script/template_literal.ts +++ b/test/typebox/runtime/type/script/template_literal.ts @@ -58,9 +58,9 @@ Test('Should TemplateLiteral 7', () => { // Embedded Infinite // ------------------------------------------------------------------ Test('Should TemplateLiteral 8', () => { - const T: Type.TTemplateLiteral<'^hello -?(?:0|[1-9][0-9]*)(?:.[0-9]+)?$'> = Type.Script('`hello ${number}`') + const T: Type.TTemplateLiteral<'^hello -?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$'> = Type.Script('`hello ${number}`') Assert.IsTrue(Type.IsTemplateLiteral(T)) - Assert.IsEqual(T.pattern, '^hello -?(?:0|[1-9][0-9]*)(?:.[0-9]+)?$') + Assert.IsEqual(T.pattern, '^hello -?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$') }) Test('Should TemplateLiteral 9', () => { const T: Type.TTemplateLiteral<'^hello .*$'> = Type.Script('`hello ${string}`') diff --git a/test/typebox/runtime/value/check/record.ts b/test/typebox/runtime/value/check/record.ts index b6885f3c8..da17208ac 100644 --- a/test/typebox/runtime/value/check/record.ts +++ b/test/typebox/runtime/value/check/record.ts @@ -323,3 +323,121 @@ Test('Should validate for never keys', () => { 1: null }) }) +// ------------------------------------------------------------------ +// NumericPattern +// ------------------------------------------------------------------ +Test('Should handle NumericPattern 1', () => { + const T = Type.Record(Type.Number(), Type.Null(), { + additionalProperties: false + }) + Ok(T, { 0: null }) + Fail(T, { '0x1': null }) +}) +Test('Should handle NumericPattern 2', () => { + const T = Type.Record(Type.Number(), Type.Null(), { + additionalProperties: false + }) + Ok(T, { 1: null }) + Fail(T, { '1x5': null }) +}) +Test('Should handle NumericPattern 3', () => { + const T = Type.Record(Type.Number(), Type.Null(), { + additionalProperties: false + }) + Ok(T, { '-1': null }) + Fail(T, { '-1x': null }) +}) +Test('Should handle NumericPattern 4', () => { + const T = Type.Record(Type.Number(), Type.Null(), { + additionalProperties: false + }) + Ok(T, { '1.5': null }) + Fail(T, { '1x5': null }) +}) +Test('Should handle NumericPattern 5', () => { + const T = Type.Record(Type.Number(), Type.Null(), { + additionalProperties: false + }) + Ok(T, { '-1.5': null }) + Fail(T, { '1.': null }) +}) +// ------------------------------------------------------------------ +// IntegerPattern +// ------------------------------------------------------------------ +Test('Should handle IntegerPattern 1', () => { + const T = Type.Record(Type.Integer(), Type.Null(), { + additionalProperties: false + }) + Ok(T, { 0: null }) + Fail(T, { '0x1': null }) +}) + +Test('Should handle IntegerPattern 2', () => { + const T = Type.Record(Type.Integer(), Type.Null(), { + additionalProperties: false + }) + Ok(T, { 1: null }) + Fail(T, { '1x5': null }) +}) + +Test('Should handle IntegerPattern 3', () => { + const T = Type.Record(Type.Integer(), Type.Null(), { + additionalProperties: false + }) + Ok(T, { '-1': null }) + Fail(T, { '-1x': null }) +}) + +Test('Should handle IntegerPattern 4', () => { + const T = Type.Record(Type.Integer(), Type.Null(), { + additionalProperties: false + }) + Ok(T, { 100: null }) + Fail(T, { '1.5': null }) +}) + +Test('Should handle IntegerPattern 5', () => { + const T = Type.Record(Type.Integer(), Type.Null(), { + additionalProperties: false + }) + Ok(T, { '-100': null }) + Fail(T, { '01': null }) +}) +// ------------------------------------------------------------------ +// StringPattern (^.*$) +// ------------------------------------------------------------------ +Test('Should handle StringPattern 1', () => { + const T = Type.Record(Type.String(), Type.Null(), { + additionalProperties: false + }) + Ok(T, { '': null }) + Ok(T, { 'hello': null }) +}) +Test('Should handle StringPattern 2', () => { + const T = Type.Record(Type.String(), Type.Null(), { + additionalProperties: false + }) + Ok(T, { ' ': null }) + Ok(T, { 'hello world': null }) +}) +Test('Should handle StringPattern 3', () => { + const T = Type.Record(Type.String(), Type.Null(), { + additionalProperties: false + }) + Ok(T, { '🎉': null }) + Ok(T, { '🎉🎉🎉': null }) +}) +Test('Should handle StringPattern 4', () => { + const T = Type.Record(Type.String(), Type.Null(), { + additionalProperties: false + }) + Ok(T, { '123': null }) + Ok(T, { '!@#$%^&*()': null }) +}) +Test('Should handle StringPattern 5', () => { + const T = Type.Record(Type.String(), Type.Null(), { + additionalProperties: false + }) + Ok(T, { 'hello 🌍': null }) + Ok(T, { 'mixed 123 !@# 🎉': null }) +}) From b038ee014406019372a6349e47fa7f98313abdc0 Mon Sep 17 00:00:00 2001 From: sinclair Date: Fri, 5 Jun 2026 12:53:03 +0900 Subject: [PATCH 2/4] ChangeLog --- changelog/1.2.0.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/changelog/1.2.0.md b/changelog/1.2.0.md index adb0db892..3e4f2e87e 100644 --- a/changelog/1.2.0.md +++ b/changelog/1.2.0.md @@ -1,6 +1,10 @@ # 1.2.0 -Advancing Programmable Runtime Types +--- + +### Version Updates +- [Revision 1.2.1](https://github.com/sinclairzx81/typebox/pull/1605) + - Fix: Escape Decimal Separator in `NumberPattern` From 73c13a5973b70d0245acc6542770fe9f0b6e70be Mon Sep 17 00:00:00 2001 From: sinclair Date: Fri, 5 Jun 2026 12:53:16 +0900 Subject: [PATCH 3/4] Version --- tasks.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks.ts b/tasks.ts index 424d8eece..e4dedaed9 100644 --- a/tasks.ts +++ b/tasks.ts @@ -9,7 +9,7 @@ import { Metrics } from './task/metrics/index.ts' import { Spec } from './task/spec/index.ts' import { Task } from 'tasksmith' -const Version = '1.2.0' +const Version = '1.2.1' // ------------------------------------------------------------------ // Build From 39e6cbfa487603734f500166432571557bad6b2b Mon Sep 17 00:00:00 2001 From: sinclair Date: Fri, 5 Jun 2026 13:04:27 +0900 Subject: [PATCH 4/4] Additional TemplateLiteral Tests --- test/typebox/runtime/value/check/record.ts | 166 +++++++++++++++++++-- 1 file changed, 152 insertions(+), 14 deletions(-) diff --git a/test/typebox/runtime/value/check/record.ts b/test/typebox/runtime/value/check/record.ts index da17208ac..3cc493b63 100644 --- a/test/typebox/runtime/value/check/record.ts +++ b/test/typebox/runtime/value/check/record.ts @@ -324,6 +324,158 @@ Test('Should validate for never keys', () => { }) }) // ------------------------------------------------------------------ +// NumericPattern via TemplateLiteral +// ------------------------------------------------------------------ +Test('Should handle NumericPattern 1', () => { + const T = Type.Record(Type.TemplateLiteral('${number}'), Type.Null(), { + additionalProperties: false + }) + Ok(T, { 0: null }) + Fail(T, { '0x1': null }) +}) +Test('Should handle NumericPattern 2', () => { + const T = Type.Record(Type.TemplateLiteral('${number}'), Type.Null(), { + additionalProperties: false + }) + Ok(T, { 1: null }) + Fail(T, { '1x5': null }) +}) +Test('Should handle NumericPattern 3', () => { + const T = Type.Record(Type.TemplateLiteral('${number}'), Type.Null(), { + additionalProperties: false + }) + Ok(T, { '-1': null }) + Fail(T, { '-1x': null }) +}) +Test('Should handle NumericPattern 4', () => { + const T = Type.Record(Type.TemplateLiteral('${number}'), Type.Null(), { + additionalProperties: false + }) + Ok(T, { '1.5': null }) + Fail(T, { '1x5': null }) +}) +Test('Should handle NumericPattern 5', () => { + const T = Type.Record(Type.TemplateLiteral('${number}'), Type.Null(), { + additionalProperties: false + }) + Ok(T, { '-1.5': null }) + Fail(T, { '1.': null }) +}) +// ------------------------------------------------------------------ +// NumericPattern via TemplateLiteral (Prefix) +// ------------------------------------------------------------------ +Test('Should handle TemplateLiteral Prefix 1', () => { + const T = Type.Record(Type.TemplateLiteral('A${number}'), Type.Null(), { + additionalProperties: false + }) + Ok(T, { 'A0': null }) + Fail(T, { 'A0x1': null }) +}) +Test('Should handle TemplateLiteral Prefix 2', () => { + const T = Type.Record(Type.TemplateLiteral('A${number}'), Type.Null(), { + additionalProperties: false + }) + Ok(T, { 'A1': null }) + Fail(T, { 'A1x5': null }) +}) +Test('Should handle TemplateLiteral Prefix 3', () => { + const T = Type.Record(Type.TemplateLiteral('A${number}'), Type.Null(), { + additionalProperties: false + }) + Ok(T, { 'A-1': null }) + Fail(T, { 'A-1x': null }) +}) +Test('Should handle TemplateLiteral Prefix 4', () => { + const T = Type.Record(Type.TemplateLiteral('A${number}'), Type.Null(), { + additionalProperties: false + }) + Ok(T, { 'A1.5': null }) + Fail(T, { 'A1x5': null }) +}) +Test('Should handle TemplateLiteral Prefix 5', () => { + const T = Type.Record(Type.TemplateLiteral('A${number}'), Type.Null(), { + additionalProperties: false + }) + Ok(T, { 'A-1.5': null }) + Fail(T, { 'A1.': null }) +}) +// ------------------------------------------------------------------ +// NumericPattern via TemplateLiteral (Postfix) +// ------------------------------------------------------------------ +Test('Should handle TemplateLiteral Postfix 1', () => { + const T = Type.Record(Type.TemplateLiteral('${number}Z'), Type.Null(), { + additionalProperties: false + }) + Ok(T, { '0Z': null }) + Fail(T, { '0x1Z': null }) +}) +Test('Should handle TemplateLiteral Postfix 2', () => { + const T = Type.Record(Type.TemplateLiteral('${number}Z'), Type.Null(), { + additionalProperties: false + }) + Ok(T, { '1Z': null }) + Fail(T, { '1x5Z': null }) +}) +Test('Should handle TemplateLiteral Postfix 3', () => { + const T = Type.Record(Type.TemplateLiteral('${number}Z'), Type.Null(), { + additionalProperties: false + }) + Ok(T, { '-1Z': null }) + Fail(T, { '-1xZ': null }) +}) +Test('Should handle TemplateLiteral Postfix 4', () => { + const T = Type.Record(Type.TemplateLiteral('${number}Z'), Type.Null(), { + additionalProperties: false + }) + Ok(T, { '1.5Z': null }) + Fail(T, { '1x5Z': null }) +}) +Test('Should handle TemplateLiteral Postfix 5', () => { + const T = Type.Record(Type.TemplateLiteral('${number}Z'), Type.Null(), { + additionalProperties: false + }) + Ok(T, { '-1.5Z': null }) + Fail(T, { '1.Z': null }) +}) +// ------------------------------------------------------------------ +// NumericPattern via TemplateLiteral (Prefix + Postfix) +// ------------------------------------------------------------------ +Test('Should handle TemplateLiteral Prefix + Postfix 1', () => { + const T = Type.Record(Type.TemplateLiteral('A${number}Z'), Type.Null(), { + additionalProperties: false + }) + Ok(T, { 'A0Z': null }) + Fail(T, { 'A0x1Z': null }) +}) +Test('Should handle TemplateLiteral Prefix + Postfix 2', () => { + const T = Type.Record(Type.TemplateLiteral('A${number}Z'), Type.Null(), { + additionalProperties: false + }) + Ok(T, { 'A1Z': null }) + Fail(T, { 'A1x5Z': null }) +}) +Test('Should handle TemplateLiteral Prefix + Postfix 3', () => { + const T = Type.Record(Type.TemplateLiteral('A${number}Z'), Type.Null(), { + additionalProperties: false + }) + Ok(T, { 'A-1Z': null }) + Fail(T, { 'A-1xZ': null }) +}) +Test('Should handle TemplateLiteral Prefix + Postfix 4', () => { + const T = Type.Record(Type.TemplateLiteral('A${number}Z'), Type.Null(), { + additionalProperties: false + }) + Ok(T, { 'A1.5Z': null }) + Fail(T, { 'A1x5Z': null }) +}) +Test('Should handle TemplateLiteral Prefix + Postfix 5', () => { + const T = Type.Record(Type.TemplateLiteral('A${number}Z'), Type.Null(), { + additionalProperties: false + }) + Ok(T, { 'A-1.5Z': null }) + Fail(T, { 'A1.Z': null }) +}) +// ------------------------------------------------------------------ // NumericPattern // ------------------------------------------------------------------ Test('Should handle NumericPattern 1', () => { @@ -427,17 +579,3 @@ Test('Should handle StringPattern 3', () => { Ok(T, { '🎉': null }) Ok(T, { '🎉🎉🎉': null }) }) -Test('Should handle StringPattern 4', () => { - const T = Type.Record(Type.String(), Type.Null(), { - additionalProperties: false - }) - Ok(T, { '123': null }) - Ok(T, { '!@#$%^&*()': null }) -}) -Test('Should handle StringPattern 5', () => { - const T = Type.Record(Type.String(), Type.Null(), { - additionalProperties: false - }) - Ok(T, { 'hello 🌍': null }) - Ok(T, { 'mixed 123 !@# 🎉': null }) -})