diff --git a/404.html b/404.html index 830eba8bc7..92ad185cb9 100644 --- a/404.html +++ b/404.html @@ -7,13 +7,13 @@ - +
Skip to main content

Page Not Found

We could not find what you were looking for.

Please contact the owner of the site that linked you to the original URL and let them know their link is broken.

- + \ No newline at end of file diff --git a/assets/js/00cf5318.8a125eb9.js b/assets/js/00cf5318.22204a20.js similarity index 84% rename from assets/js/00cf5318.8a125eb9.js rename to assets/js/00cf5318.22204a20.js index b95fccc707..ac4ed35726 100644 --- a/assets/js/00cf5318.8a125eb9.js +++ b/assets/js/00cf5318.22204a20.js @@ -1 +1 @@ -"use strict";(self.webpackChunkarktype_io=self.webpackChunkarktype_io||[]).push([[2216],{57522:(e,n,t)=>{t.d(n,{Zo:()=>l,kt:()=>f});var r=t(29901);function o(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function a(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function i(e){for(var n=1;n=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var p=r.createContext({}),c=function(e){var n=r.useContext(p),t=n;return e&&(t="function"==typeof e?e(n):i(i({},n),e)),t},l=function(e){var n=c(e.components);return r.createElement(p.Provider,{value:n},e.children)},d="mdxType",m={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},u=r.forwardRef((function(e,n){var t=e.components,o=e.mdxType,a=e.originalType,p=e.parentName,l=s(e,["components","mdxType","originalType","parentName"]),d=c(t),u=o,f=d["".concat(p,".").concat(u)]||d[u]||m[u]||a;return t?r.createElement(f,i(i({ref:n},l),{},{components:t})):r.createElement(f,i({ref:n},l))}));function f(e,n){var t=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var a=t.length,i=new Array(a);i[0]=u;var s={};for(var p in n)hasOwnProperty.call(n,p)&&(s[p]=n[p]);s.originalType=e,s[d]="string"==typeof e?e:o,i[1]=s;for(var c=2;c{t.d(n,{g:()=>y});var r=t(56632),o=t(82786),a=t(53800),i=t(49361),s=t(29901),p=t(43346);var c=function(e){var n=l[e];return'import {populateDemo} from "./populateDemo"\n(async () => {\n try {\n '+n[0]+"\n populateDemo("+n[1]+')\n } catch(e) {\n populateDemo({ \n type: {\n definition: ""\n },\n data: "",\n problems: "ParseError: " + e.originalErr.message\n } as any)\n }\n})()'},l={type:['const { user, data, problems } = await import("./type")',"{ type: user, data, problems }"],scope:['const { types, data, problems } = await import("./scope")',"{ type: types.package, data, problems }"],demo:['const { pkg, data, problems } = await import("./demo")',"{ type: pkg, data, problems }"]};var d={"index.html":'\n \n\n
\n
\n
\n

Definition

\n
\n
\n
\n
\n
\n

Output

\n
\n
\n
\n
\n',"demo.css":'body {\n font-family: "Cascadia Code", sans-serif;\n background-color: hsl(220 18% 10%);\n}\n\n#demo {\n display: flex;\n flex-direction: column;\n gap: 1rem;\n margin: -0.5rem;\n padding: 0.5rem;\n}\n\n#input {\n display: flex;\n flex-direction: row;\n flex-wrap: wrap;\n gap: 0.5rem;\n}\n\n.section {\n display: flex;\n flex-direction: column;\n flex-grow: 1;\n gap: 0.5rem;\n}\n\np {\n white-space: pre-wrap;\n}\n\npre {\n white-space: pre-wrap;\n}\n\nh3 {\n margin: 0px;\n color: #fffff0;\n}\n\n.key {\n color: #80cff8;\n}\n.val {\n color: #f5cf8f;\n}\n.operator {\n color: #eb9f2e;\n}\n.bracket {\n color: #009eff;\n}\n.card {\n padding: 1rem;\n background-color: rgb(18, 18, 18);\n color: rgb(255, 255, 255);\n /* transition: box-shadow 300ms cubic-bezier(0.4, 0, 0.2, 1) 0ms; */\n border-radius: 1rem;\n box-shadow: rgba(0, 0, 0, 0.2) 0px 2px 1px -1px,\n rgba(0, 0, 0, 0.14) 0px 1px 1px 0px, rgba(0, 0, 0, 0.12) 0px 1px 3px 0px;\n background-image: linear-gradient(\n rgba(255, 255, 255, 0.05),\n rgba(255, 255, 255, 0.05)\n );\n height: 100%;\n}\n',"populateDemo.ts":'import "./demo.css"\nimport type { Problems, Type } from "arktype"\nimport { stringify } from "arktype/internal/utils/serialize.js"\n\ntype PopulateDemoArgs = {\n type: Type\n data: unknown\n problems: Problems\n}\nexport const populateDemo = ({ data, type, problems }: PopulateDemoArgs) => {\n const defElement = document.querySelector("#definition")!\n defElement.textContent = stringify(type.definition, 2)\n defElement.innerHTML = recolor(defElement.innerHTML)\n\n const resultElement = document.querySelector("#output")!\n if (problems) {\n resultElement.textContent = `\u274c problems:\n\n${problems}`\n } else {\n resultElement.textContent = `\u2705 data:\n\n${stringify(data, 2)}`\n resultElement.innerHTML = recolor(resultElement.innerHTML)\n }\n}\n\nconst recolor = (input: string) => {\n const lines = input.split("\\n")\n const fixedInput: string[] = [""]\n for (const line of lines) {\n if (line.includes(":")) {\n const parts = line.split(":")\n fixedInput.push(`${buildKey(parts[0])}: ${buildVal(parts[1])}`)\n } else {\n fixedInput.push(addArkdarkStyles(line))\n }\n }\n fixedInput.push("")\n return fixedInput.join("\\n")\n}\n\nconst buildKey = (key: string) => {\n return `${key}`\n}\nconst buildVal = (val: string) => {\n const formatted = addArkdarkStyles(val.trim())\n if (formatted[formatted.length - 1] === ",") {\n return `${formatted.replace(",", "")},`\n } else if (formatted[formatted.length - 1] === "{") {\n return "{"\n }\n return `${formatted}`\n}\nconst addArkdarkStyles = (line: string) => {\n const brackets = ["[", "]", "(", ")"]\n const operators = [">", "<", ">e;", "<e;", "|"]\n let modifiedLine = line\n for (const bracket of brackets) {\n modifiedLine = modifiedLine.replaceAll(\n bracket,\n `${bracket}`\n )\n }\n for (const operator of operators) {\n modifiedLine = modifiedLine.replaceAll(\n operator,\n `${operator}`\n )\n }\n return modifiedLine\n}\n',"tsconfig.json":JSON.stringify({compilerOptions:{module:"esnext",target:"esnext",strict:!0}},null,4)},m={type:'import { type } from "arktype"\n\n// Definitions are statically parsed and inferred as TS.\nexport const user = type({\n name: "string",\n device: {\n platform: "\'android\'|\'ios\'",\n "version?": "number"\n }\n})\n\n// Validators return typed data or clear, customizable errors.\nexport const { data, problems } = user({\n name: "Alan Turing",\n device: {\n // problems.summary: "device/platform must be \'android\' or \'ios\' (was \'enigma\')"\n platform: "enigma"\n }\n})\n',scope:'import { scope } from "arktype"\n\n// Scopes are collections of types that can reference each other.\nexport const types = scope({\n package: {\n name: "string",\n "dependencies?": "package[]",\n "contributors?": "contributor[]"\n },\n contributor: {\n // Subtypes like \'email\' are inferred like \'string\' but provide additional validation at runtime.\n email: "email",\n "packages?": "package[]"\n }\n}).compile()\n\n// Cyclic types are inferred to arbitrary depth...\nexport type Package = typeof types.package.infer\n\n// And can validate cyclic data.\nconst packageData: Package = {\n name: "arktype",\n dependencies: [{ name: "typescript" }],\n contributors: [{ email: "david@sharktypeio" }]\n}\npackageData.dependencies![0].dependencies = [packageData]\n\nexport const { data, problems } = types.package(packageData)\n',demo:'import { type } from "arktype"\n\n// Define your type...\nexport const pkg = type({\n name: "string",\n version: "semver",\n "contributors?": "1{t.r(n),t.d(n,{assets:()=>d,contentTitle:()=>c,default:()=>y,frontMatter:()=>p,metadata:()=>l,toc:()=>m});var r=t(54805),o=t(30008),a=(t(29901),t(57522)),i=t(76570),s=["components"],p={hide_table_of_contents:!0},c="Scopes",l={unversionedId:"scopes",id:"scopes",title:"Scopes",description:"",source:"@site/docs/scopes.mdx",sourceDirName:".",slug:"/scopes",permalink:"/docs/next/scopes",draft:!1,tags:[],version:"current",frontMatter:{hide_table_of_contents:!0},sidebar:"sidebar",previous:{title:"Intro",permalink:"/docs/next/"},next:{title:"Keywords",permalink:"/docs/next/api/keywords"}},d={},m=[],u={toc:m},f="wrapper";function y(e){var n=e.components,t=(0,o.Z)(e,s);return(0,a.kt)(f,(0,r.Z)({},u,t,{components:n,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"scopes"},"Scopes"),(0,a.kt)(i.g,{embedId:"scope",mdxType:"StackBlitzDemo"}))}y.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkarktype_io=self.webpackChunkarktype_io||[]).push([[2216],{57522:(e,n,t)=>{t.d(n,{Zo:()=>l,kt:()=>f});var r=t(29901);function o(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function a(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function i(e){for(var n=1;n=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var p=r.createContext({}),c=function(e){var n=r.useContext(p),t=n;return e&&(t="function"==typeof e?e(n):i(i({},n),e)),t},l=function(e){var n=c(e.components);return r.createElement(p.Provider,{value:n},e.children)},d="mdxType",m={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},u=r.forwardRef((function(e,n){var t=e.components,o=e.mdxType,a=e.originalType,p=e.parentName,l=s(e,["components","mdxType","originalType","parentName"]),d=c(t),u=o,f=d["".concat(p,".").concat(u)]||d[u]||m[u]||a;return t?r.createElement(f,i(i({ref:n},l),{},{components:t})):r.createElement(f,i({ref:n},l))}));function f(e,n){var t=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var a=t.length,i=new Array(a);i[0]=u;var s={};for(var p in n)hasOwnProperty.call(n,p)&&(s[p]=n[p]);s.originalType=e,s[d]="string"==typeof e?e:o,i[1]=s;for(var c=2;c{t.d(n,{g:()=>y});var r=t(56632),o=t(82786),a=t(53800),i=t(49361),s=t(29901),p=t(43346);var c=function(e){var n=l[e];return'import {populateDemo} from "./populateDemo"\n(async () => {\n try {\n '+n[0]+"\n populateDemo("+n[1]+')\n } catch(e) {\n populateDemo({ \n type: {\n definition: ""\n },\n data: "",\n problems: "ParseError: " + e.originalErr.message\n } as any)\n }\n})()'},l={type:['const { user, data, problems } = await import("./type")',"{ type: user, data, problems }"],scope:['const { types, data, problems } = await import("./scope")',"{ type: types.package, data, problems }"],demo:['const { pkg, data, problems } = await import("./demo")',"{ type: pkg, data, problems }"]};var d={"index.html":'\n \n\n
\n
\n
\n

Definition

\n
\n
\n
\n
\n
\n

Output

\n
\n
\n
\n
\n',"demo.css":'body {\n font-family: "Cascadia Code", sans-serif;\n background-color: hsl(220 18% 10%);\n}\n\n#demo {\n display: flex;\n flex-direction: column;\n gap: 1rem;\n margin: -0.5rem;\n padding: 0.5rem;\n}\n\n#input {\n display: flex;\n flex-direction: row;\n flex-wrap: wrap;\n gap: 0.5rem;\n}\n\n.section {\n display: flex;\n flex-direction: column;\n flex-grow: 1;\n gap: 0.5rem;\n}\n\np {\n white-space: pre-wrap;\n}\n\npre {\n white-space: pre-wrap;\n}\n\nh3 {\n margin: 0px;\n color: #fffff0;\n}\n\n.key {\n color: #80cff8;\n}\n.val {\n color: #f5cf8f;\n}\n.operator {\n color: #eb9f2e;\n}\n.bracket {\n color: #009eff;\n}\n.card {\n padding: 1rem;\n background-color: rgb(18, 18, 18);\n color: rgb(255, 255, 255);\n /* transition: box-shadow 300ms cubic-bezier(0.4, 0, 0.2, 1) 0ms; */\n border-radius: 1rem;\n box-shadow: rgba(0, 0, 0, 0.2) 0px 2px 1px -1px,\n rgba(0, 0, 0, 0.14) 0px 1px 1px 0px, rgba(0, 0, 0, 0.12) 0px 1px 3px 0px;\n background-image: linear-gradient(\n rgba(255, 255, 255, 0.05),\n rgba(255, 255, 255, 0.05)\n );\n height: 100%;\n}\n',"populateDemo.ts":'import "./demo.css"\nimport type { Problems, Type } from "arktype"\nimport { stringify } from "arktype/internal/utils/serialize.js"\n\ntype PopulateDemoArgs = {\n type: Type\n data: unknown\n problems: Problems\n}\nexport const populateDemo = ({ data, type, problems }: PopulateDemoArgs) => {\n const defElement = document.querySelector("#definition")!\n defElement.textContent = stringify(type.definition, 2)\n defElement.innerHTML = recolor(defElement.innerHTML)\n\n const resultElement = document.querySelector("#output")!\n if (problems) {\n resultElement.textContent = `\u274c problems:\n\n${problems}`\n } else {\n resultElement.textContent = `\u2705 data:\n\n${stringify(data, 2)}`\n resultElement.innerHTML = recolor(resultElement.innerHTML)\n }\n}\n\nconst recolor = (input: string) => {\n const lines = input.split("\\n")\n const fixedInput: string[] = [""]\n for (const line of lines) {\n if (line.includes(":")) {\n const parts = line.split(":")\n fixedInput.push(`${buildKey(parts[0])}: ${buildVal(parts[1])}`)\n } else {\n fixedInput.push(addArkdarkStyles(line))\n }\n }\n fixedInput.push("")\n return fixedInput.join("\\n")\n}\n\nconst buildKey = (key: string) => {\n return `${key}`\n}\nconst buildVal = (val: string) => {\n const formatted = addArkdarkStyles(val.trim())\n if (formatted[formatted.length - 1] === ",") {\n return `${formatted.replace(",", "")},`\n } else if (formatted[formatted.length - 1] === "{") {\n return "{"\n }\n return `${formatted}`\n}\nconst addArkdarkStyles = (line: string) => {\n const brackets = ["[", "]", "(", ")"]\n const operators = [">", "<", ">e;", "<e;", "|"]\n let modifiedLine = line\n for (const bracket of brackets) {\n modifiedLine = modifiedLine.replaceAll(\n bracket,\n `${bracket}`\n )\n }\n for (const operator of operators) {\n modifiedLine = modifiedLine.replaceAll(\n operator,\n `${operator}`\n )\n }\n return modifiedLine\n}\n',"tsconfig.json":JSON.stringify({compilerOptions:{module:"esnext",target:"esnext",strict:!0}},null,4)},m={type:'import { type } from "arktype"\n\n// Definitions are statically parsed and inferred as TS.\nexport const user = type({\n name: "string",\n device: {\n platform: "\'android\'|\'ios\'",\n "version?": "number"\n }\n})\n\n// Validators return typed data or clear, customizable errors.\nexport const { data, problems } = user({\n name: "Alan Turing",\n device: {\n // problems.summary: "device/platform must be \'android\' or \'ios\' (was \'enigma\')"\n platform: "enigma"\n }\n})\n',scope:'import { scope } from "arktype"\n\n// Scopes are collections of types that can reference each other.\nexport const types = scope({\n package: {\n name: "string",\n "dependencies?": "package[]",\n "contributors?": "contributor[]"\n },\n contributor: {\n // Subtypes like \'email\' are inferred like \'string\' but provide additional validation at runtime.\n email: "email",\n "packages?": "package[]"\n }\n}).compile()\n\n// Cyclic types are inferred to arbitrary depth...\nexport type Package = typeof types.package.infer\n\n// And can validate cyclic data.\nconst packageData: Package = {\n name: "arktype",\n dependencies: [{ name: "typescript" }],\n contributors: [{ email: "david@sharktypeio" }]\n}\npackageData.dependencies![0].dependencies = [packageData]\n\nexport const { data, problems } = types.package(packageData)\n',demo:'import { type } from "arktype"\n\n// Define your type...\nexport const pkg = type({\n name: "string",\n version: "semver",\n "contributors?": "1{t.r(n),t.d(n,{assets:()=>d,contentTitle:()=>c,default:()=>y,frontMatter:()=>p,metadata:()=>l,toc:()=>m});var r=t(54805),o=t(30008),a=(t(29901),t(57522)),i=t(76570),s=["components"],p={hide_table_of_contents:!0},c="Scopes",l={unversionedId:"scopes",id:"scopes",title:"Scopes",description:"",source:"@site/docs/scopes.mdx",sourceDirName:".",slug:"/scopes",permalink:"/docs/next/scopes",draft:!1,tags:[],version:"current",frontMatter:{hide_table_of_contents:!0},sidebar:"sidebar",previous:{title:"Intro",permalink:"/docs/next/"},next:{title:"Keywords",permalink:"/docs/next/api/keywords"}},d={},m=[],u={toc:m},f="wrapper";function y(e){var n=e.components,t=(0,o.Z)(e,s);return(0,a.kt)(f,(0,r.Z)({},u,t,{components:n,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"scopes"},"Scopes"),(0,a.kt)(i.g,{embedId:"scope",mdxType:"StackBlitzDemo"}))}y.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/1df93b7f.0f5036cb.js b/assets/js/1df93b7f.0f5036cb.js deleted file mode 100644 index 90335f15b6..0000000000 --- a/assets/js/1df93b7f.0f5036cb.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkarktype_io=self.webpackChunkarktype_io||[]).push([[3237],{76570:(e,t,n)=>{n.d(t,{g:()=>h});var r=n(56632),a=n(82786),i=n(53800),o=n(49361),l=n(29901),c=n(43346);var s=function(e){var t=m[e];return'import {populateDemo} from "./populateDemo"\n(async () => {\n try {\n '+t[0]+"\n populateDemo("+t[1]+')\n } catch(e) {\n populateDemo({ \n type: {\n definition: ""\n },\n data: "",\n problems: "ParseError: " + e.originalErr.message\n } as any)\n }\n})()'},m={type:['const { user, data, problems } = await import("./type")',"{ type: user, data, problems }"],scope:['const { types, data, problems } = await import("./scope")',"{ type: types.package, data, problems }"],demo:['const { pkg, data, problems } = await import("./demo")',"{ type: pkg, data, problems }"]};var p={"index.html":'\n \n\n
\n
\n
\n

Definition

\n
\n
\n
\n
\n
\n

Output

\n
\n
\n
\n
\n',"demo.css":'body {\n font-family: "Cascadia Code", sans-serif;\n background-color: hsl(220 18% 10%);\n}\n\n#demo {\n display: flex;\n flex-direction: column;\n gap: 1rem;\n margin: -0.5rem;\n padding: 0.5rem;\n}\n\n#input {\n display: flex;\n flex-direction: row;\n flex-wrap: wrap;\n gap: 0.5rem;\n}\n\n.section {\n display: flex;\n flex-direction: column;\n flex-grow: 1;\n gap: 0.5rem;\n}\n\np {\n white-space: pre-wrap;\n}\n\npre {\n white-space: pre-wrap;\n}\n\nh3 {\n margin: 0px;\n color: #fffff0;\n}\n\n.key {\n color: #80cff8;\n}\n.val {\n color: #f5cf8f;\n}\n.operator {\n color: #eb9f2e;\n}\n.bracket {\n color: #009eff;\n}\n.card {\n padding: 1rem;\n background-color: rgb(18, 18, 18);\n color: rgb(255, 255, 255);\n /* transition: box-shadow 300ms cubic-bezier(0.4, 0, 0.2, 1) 0ms; */\n border-radius: 1rem;\n box-shadow: rgba(0, 0, 0, 0.2) 0px 2px 1px -1px,\n rgba(0, 0, 0, 0.14) 0px 1px 1px 0px, rgba(0, 0, 0, 0.12) 0px 1px 3px 0px;\n background-image: linear-gradient(\n rgba(255, 255, 255, 0.05),\n rgba(255, 255, 255, 0.05)\n );\n height: 100%;\n}\n',"populateDemo.ts":'import "./demo.css"\nimport type { Problems, Type } from "arktype"\nimport { stringify } from "arktype/internal/utils/serialize.js"\n\ntype PopulateDemoArgs = {\n type: Type\n data: unknown\n problems: Problems\n}\nexport const populateDemo = ({ data, type, problems }: PopulateDemoArgs) => {\n const defElement = document.querySelector("#definition")!\n defElement.textContent = stringify(type.definition, 2)\n defElement.innerHTML = recolor(defElement.innerHTML)\n\n const resultElement = document.querySelector("#output")!\n if (problems) {\n resultElement.textContent = `\u274c problems:\n\n${problems}`\n } else {\n resultElement.textContent = `\u2705 data:\n\n${stringify(data, 2)}`\n resultElement.innerHTML = recolor(resultElement.innerHTML)\n }\n}\n\nconst recolor = (input: string) => {\n const lines = input.split("\\n")\n const fixedInput: string[] = [""]\n for (const line of lines) {\n if (line.includes(":")) {\n const parts = line.split(":")\n fixedInput.push(`${buildKey(parts[0])}: ${buildVal(parts[1])}`)\n } else {\n fixedInput.push(addArkdarkStyles(line))\n }\n }\n fixedInput.push("")\n return fixedInput.join("\\n")\n}\n\nconst buildKey = (key: string) => {\n return `${key}`\n}\nconst buildVal = (val: string) => {\n const formatted = addArkdarkStyles(val.trim())\n if (formatted[formatted.length - 1] === ",") {\n return `${formatted.replace(",", "")},`\n } else if (formatted[formatted.length - 1] === "{") {\n return "{"\n }\n return `${formatted}`\n}\nconst addArkdarkStyles = (line: string) => {\n const brackets = ["[", "]", "(", ")"]\n const operators = [">", "<", ">e;", "<e;", "|"]\n let modifiedLine = line\n for (const bracket of brackets) {\n modifiedLine = modifiedLine.replaceAll(\n bracket,\n `${bracket}`\n )\n }\n for (const operator of operators) {\n modifiedLine = modifiedLine.replaceAll(\n operator,\n `${operator}`\n )\n }\n return modifiedLine\n}\n',"tsconfig.json":JSON.stringify({compilerOptions:{module:"esnext",target:"esnext",strict:!0}},null,4)},d={type:'import { type } from "arktype"\n\n// Definitions are statically parsed and inferred as TS.\nexport const user = type({\n name: "string",\n device: {\n platform: "\'android\'|\'ios\'",\n "version?": "number"\n }\n})\n\n// Validators return typed data or clear, customizable errors.\nexport const { data, problems } = user({\n name: "Alan Turing",\n device: {\n // problems.summary: "device/platform must be \'android\' or \'ios\' (was \'enigma\')"\n platform: "enigma"\n }\n})\n',scope:'import { scope } from "arktype"\n\n// Scopes are collections of types that can reference each other.\nexport const types = scope({\n package: {\n name: "string",\n "dependencies?": "package[]",\n "contributors?": "contributor[]"\n },\n contributor: {\n // Subtypes like \'email\' are inferred like \'string\' but provide additional validation at runtime.\n email: "email",\n "packages?": "package[]"\n }\n}).compile()\n\n// Cyclic types are inferred to arbitrary depth...\nexport type Package = typeof types.package.infer\n\n// And can validate cyclic data.\nconst packageData: Package = {\n name: "arktype",\n dependencies: [{ name: "typescript" }],\n contributors: [{ email: "david@sharktypeio" }]\n}\npackageData.dependencies![0].dependencies = [packageData]\n\nexport const { data, problems } = types.package(packageData)\n',demo:'import { type } from "arktype"\n\n// Define your type...\nexport const pkg = type({\n name: "string",\n version: "semver",\n "contributors?": "1{n.r(t),n.d(t,{default:()=>se});var r,a,i,o,l,c,s,m,p,d,u,f=n(43597),h=n(78099),g=n(2372),y=n(29901),b=n(63221),v=n(53800),E=n(85569),k=n(54805),x=n(55850),w=n(68584),Z=n(70856),z=function(e){return y.createElement("video",(0,k.Z)({autoPlay:!0,loop:!0,controls:!0,playsInline:!0,muted:!0,disablePictureInPicture:!0},e))},T=n(14043),C=function(){return(0,T.Z)("(max-width:1250px)")},I=y.createElement("div",{className:"inferable-code"},y.createElement(Z.Z,{language:"typescript"},'const user = type({\n name: "string",\n device: {\n platform: "\'android\'|\'ios\'",\n "version?": "number"\n }\n})\n\n\n// Hover to infer...\ntype User = typeof user.infer\n'),y.createElement("img",{height:"50%",src:"/img/isomorphicHover.png"})),S=y.createElement("div",{className:"inferable-code"},y.createElement(Z.Z,{language:"typescript"},"// Hover to infer...\n",'const arkUser = type({\n name: /^ark.*$/ as Infer<`ark${string}`>,\n birthday: morph("string", (s) => new Date(s)),\n "powerLevel?": "1<=number<9000"\n})'),y.createElement("img",{height:"60%",src:"/img/arkUser.png"})),H=y.createElement("div",{className:"inferable-code"},y.createElement(Z.Z,{language:"typescript"},"// Hover to infer...\n",'const zodUser = z.object({\n name: z.custom<`zod${string}`>(\n (val) => typeof val === "string" && /^zod.*$/.test(val)\n ),\n birthday: z.preprocess(\n (arg) => (typeof arg === "string" ? new Date(arg) : undefined),\n z.date()\n ),\n powerLevel: z.number().gte(1).lt(9000).optional()\n})'),y.createElement("img",{height:"80%",src:"/img/zodInfer.png"})),O=y.createElement(y.Fragment,null,S,H),j=y.createElement("div",{className:"inferable-code"},y.createElement(Z.Z,{language:"typescript"},"// Hover to see internal representation...\n","export const deepLeftOrRight = union(\n {\n auto: {\n discriminated: \"'left'\"\n }\n },\n {\n auto: {\n discriminated: \"'right'\"\n }\n }\n)"),y.createElement("img",{src:"/img/optimizedUnion.png"})),D=y.createElement("div",{className:"inferable-code"},y.createElement(Z.Z,{language:"typescript"},"// Hover to see internal representation...\n",'export const numericIntersection = type(\n "(1 <= number%2 < 100) & (0 < number%3 <= 99)"\n)',"\n \n\n\n\n\n"),y.createElement("img",{src:"/img/optimizedNumber.png"})),M=[{title:"Isomorphic",description:"Define types using TS syntax. Infer them 1:1. Use them to validate your data at runtime.",image:I},{title:"Concise",description:"Say more with less",image:O},{title:"Optimized",description:"ArkType is not just a validator\u2014 it's a full type system. Operations are deeply computed and optimized by default",image:y.createElement(y.Fragment,null,j,D)},{title:"Type-safe",description:"String definitions are statically parsed with each character you type and give detailed feedback just like in your editor.",image:y.createElement(v.Z,{width:"100%"},y.createElement(z,{src:"/img/typePerf.mp4"}),y.createElement("caption",{style:{fontSize:".8rem"}},"Worried about performance? Don't be. This is how it feels to interact with a scope of 100 cyclic types (you may want to go fullscreen to see the details!)"))}],P=function(){return y.createElement(x.ZP,{sx:{alignContent:"center"},columns:C()?1:2,spacing:3},M.map((function(e,t){return y.createElement(L,(0,k.Z)({key:t},e))})))},L=function(e){var t,n=(0,w.Z)();return y.createElement(v.Z,{spacing:2,maxWidth:"40em"},y.createElement(E.Z,{component:"h3",variant:"h5",fontWeight:"700",width:"100%",textAlign:"center",color:n.palette.info.main},e.title),y.createElement(E.Z,{component:"p",variant:"body1",fontWeight:"300",minHeight:"3rem"},e.description),y.createElement("div",{style:{padding:"6px",borderRadius:"16px"}},null!=(t=e.image)?t:null))},N=n(96172),$=n(36832),A=n(50931),F=n(73760),W=n(35601),U=n(76570),q=n(17188),R=n(39069),V=function(){var e=(0,N.TH)().pathname,t=(0,w.Z)().palette,n="dark"===(0,b.I)().colorMode,r=(0,y.useState)(e.includes("try")),a=r[0],i=r[1],o=n?"#ffffff00":"#000000aa";return y.createElement(y.Fragment,null,y.createElement(v.Z,{alignItems:"start",width:"100%"},y.createElement(F.Z,{variant:"contained",sx:{backgroundColor:o,backdropFilter:"blur(4px)",borderRadius:"2rem",fontSize:"1.5rem",fontFamily:'"Cascadia Code", sans-serif',textTransform:"none",color:t.primary.main,"&:hover":{backgroundColor:o,color:t.secondary.main,backdropFilter:"blur(6px)"},zIndex:1},onClick:function(){return i(!a)},endIcon:y.createElement("div",{style:{display:"flex"}},a?y.createElement($.Z,null):y.createElement(A.Z,null))},a?"$ wq!":"$ code demo.ts",y.createElement(W.E.div,{animate:{opacity:0},transition:{duration:.5,repeatType:"mirror",repeat:1/0}},"_"))),y.createElement(v.Z,{width:"100%"},a?y.createElement(U.g,{embedId:"demo"}):y.createElement(z,{src:"/img/arktype.mp4",style:{width:"100%",marginTop:"-2.8rem"}})),y.createElement("sub",{style:{marginLeft:"2.3px",marginTop:"5px"}},y.createElement("code",null,"typescript@4.9.5")," in VS Code\u2014 no extensions or plugins required (",y.createElement("a",{href:"https://github.com/arktypeio/arktype#how",target:"_blank"},"how?"),")"))},_=n(47699),J=n(54852),G=n(17739),K=n(57487),B=n(84123),Y=function(){var e=(0,K.v)().scrollY,t=(0,B._)(),n={position:"absolute",top:60,width:386};return e.onChange((function(e){t.start(e?{position:"fixed",top:"50%",width:340}:n)})),y.createElement(W.E.div,{style:{right:0},initial:n,animate:t},y.createElement(X,null))},Q=function(){return y.createElement("div",{style:{width:"100%"}},y.createElement(X,null))},X=function(){return y.createElement(_.Z,{style:{height:"8rem",margin:".5rem",padding:".7rem 1rem 0rem",backgroundColor:"#ffffff00",backdropFilter:"blur(1px)",borderRadius:"2rem",zIndex:1,fontFamily:'"Cascadia Code", sans-serif'},elevation:8},y.createElement(G.Z,{className:"installationTabs"},y.createElement(J.Z,{value:"node",default:!0},y.createElement(G.Z,{className:"subTabs"},y.createElement(J.Z,{value:"npm",attributes:{className:"npmTab"}},y.createElement(Z.Z,{language:"bash"},"npm install arktype")),y.createElement(J.Z,{value:"pnpm",attributes:{className:"pnpmTab"}},y.createElement(Z.Z,{language:"bash"},"pnpm add arktype")),y.createElement(J.Z,{value:"yarn",attributes:{className:"yarnTab"}},y.createElement(Z.Z,{language:"bash"},"yarn add arktype")))),y.createElement(J.Z,{value:"bun",label:"bun"},y.createElement(Z.Z,{language:"bash"},"bun install arktype")),y.createElement(J.Z,{value:"deno",label:"deno"},y.createElement(Z.Z,{language:"typescript"},'import { type } from "npm:arktype"'))))},ee=function(){var e=(0,b.I)().colorMode;return y.createElement("main",{style:{display:"flex",justifyContent:"center"}},y.createElement(v.Z,{justifyContent:"center",padding:"1rem 0rem 1rem",spacing:1,width:"100%",maxWidth:"60rem"},y.createElement(V,null),(0,T.Z)("(min-width:1420px)")?y.createElement(Y,null):y.createElement(Q,null),y.createElement(E.Z,{color:"dark"===e?"primary.light":"primary.dark",className:"contents",fontSize:"1.3rem"},y.createElement("p",null,"ArkType is a runtime validation library that can infer"," ",y.createElement("b",null,"TypeScript definitions 1:1")," and reuse them as"," ",y.createElement("b",null,"highly-optimized validators")," for your data."),y.createElement("p",null,"With each character you type, you'll get"," ",y.createElement("b",null,"immediate feedback from your editor")," in the form of either a fully-inferred ",y.createElement("code",null,"Type")," or a specific and helpful ",y.createElement("code",null,"ParseError"),"."),y.createElement("p",null,"This result exactly mirrors what you can expect to happen at runtime down to the punctuation of the error message- ",y.createElement("b",null,"no plugins required"),".")),y.createElement(P,null)))},te=["title","titleId"];function ne(){return ne=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}const ae=function(e){var t=e.title,n=e.titleId,f=re(e,te);return y.createElement("svg",ne({viewBox:"0 0 375 375","aria-labelledby":n},f),t?y.createElement("title",{id:n},t):null,r||(r=y.createElement("path",{fill:"#4b3621",d:"M5.314 281.357h27.799l9.62-38.835a5.288 5.337 0 0 1 5.156-4.077h212.609a5.288 5.337 0 0 1 5.156 4.077l9.461 38.3 37.844-4.775c1.754-.268 3.508.43 4.678 1.824 1.169 1.34 1.542 3.218 1.063 4.935l-10.63 37.548a5.295 5.344 0 0 1-5.103 3.916H5.315c-2.923 0-5.316-2.414-5.316-5.364V286.72c0-2.95 2.391-5.364 5.315-5.364Zm127.566-32.184H52.035l-7.972 32.184h88.817zm31.89 0h-21.26v32.184h21.26zm91.582 0h-80.95v32.184h88.923zM10.63 313.542h288.35l7.283-25.855-34.55 4.344c-.212.054-.425.054-.637.054H10.629v21.457z"})),a||(a=y.createElement("path",{fill:"none",d:"M106.994 267.84a5.281 5.33 0 0 0 4.624 2.789c.904 0 1.754-.215 2.604-.697a5.358 5.358 0 0 0 2.073-7.296c-1.435-2.574-4.624-3.54-7.229-2.092-2.55 1.449-3.507 4.72-2.072 7.296zm-43.212-2.575c0 2.95 2.338 5.364 5.262 5.364h.052c2.924 0 5.316-2.414 5.316-5.364 0-2.95-2.392-5.364-5.316-5.364-2.923 0-5.314 2.413-5.314 5.364zm127.671.805c.425 2.628 2.658 4.56 5.262 4.56.266 0 .531 0 .797-.054 2.87-.43 4.943-3.165 4.465-6.115-.426-2.95-3.083-4.989-6.006-4.506h-.053c-2.87.428-4.89 3.165-4.465 6.114zm21.155-.805c0 2.95 2.391 5.364 5.315 5.364 2.924 0 5.369-2.414 5.369-5.364 0-2.95-2.392-5.364-5.316-5.364h-.053c-2.923 0-5.315 2.413-5.315 5.364zm-127.566 0c0 2.95 2.339 5.364 5.262 5.364h.053c2.923 0 5.316-2.414 5.316-5.364 0-2.95-2.392-5.364-5.316-5.364s-5.315 2.413-5.315 5.364zm152.866 5.203a5.232 5.28 0 0 0 1.276.161 5.284 5.284 0 0 0 5.156-4.077c.744-2.843-.957-5.793-3.827-6.49h-.053c-2.87-.698-5.74 1.018-6.432 3.916a5.39 5.39 0 0 0 3.88 6.49z"})),i||(i=y.createElement("path",{fill:"none",d:"M182.736 249.173h73.616l6.644 26.82h-80.26Zm55.172 21.295a5.232 5.28 0 0 0 1.276.161 5.284 5.284 0 0 0 5.156-4.077c.744-2.843-.957-5.793-3.827-6.49h-.053c-2.87-.698-5.74 1.018-6.432 3.916a5.39 5.39 0 0 0 3.88 6.49zm-19.985.161c2.923 0 5.369-2.414 5.369-5.364 0-2.95-2.392-5.364-5.316-5.364h-.053c-2.923 0-5.315 2.413-5.315 5.364 0 2.95 2.392 5.364 5.315 5.364zm-21.208 0c.266 0 .532 0 .798-.053 2.87-.43 4.943-3.165 4.464-6.115-.425-2.95-3.082-4.989-6.006-4.506h-.053c-2.87.43-4.89 3.165-4.464 6.115.424 2.627 2.657 4.56 5.262 4.56z"})),o||(o=y.createElement("path",{fill:"none",d:"M182.736 249.173v26.82h80.26l1.329 5.364H175.4v-32.184zm-17.966 0h-13.925v26.82h13.925z"})),l||(l=y.createElement("path",{fill:"none",d:"M150.845 249.173v26.82h13.925v5.364h-21.26v-32.184zm-92.805 0h74.84v26.82H51.397Zm48.954 18.667a5.281 5.33 0 0 0 4.624 2.789c.904 0 1.754-.215 2.604-.697a5.358 5.358 0 0 0 2.073-7.296c-1.435-2.574-4.624-3.54-7.229-2.092-2.55 1.449-3.507 4.72-2.072 7.296zm-16.69 2.79h.053c2.923 0 5.316-2.415 5.316-5.365s-2.392-5.364-5.316-5.364-5.315 2.413-5.315 5.364c0 2.95 2.34 5.364 5.262 5.364zm-21.26 0h.052c2.924 0 5.316-2.415 5.316-5.365s-2.392-5.364-5.316-5.364c-2.923 0-5.315 2.413-5.315 5.364 0 2.95 2.34 5.364 5.262 5.364z"})),c||(c=y.createElement("path",{fill:"none",d:"M52.035 249.173h6.006l-6.644 26.82h81.483v5.364H44.062Zm-34.071 42.912h253.111c.213 0 .426 0 .638-.053l34.55-4.345-5.773 20.49H17.964Z"})),s||(s=y.createElement("path",{fill:"none",d:"m300.49 308.178-1.51 5.364zM17.964 292.085v16.093H300.49l-1.51 5.364H10.63v-21.457z"})),m||(m=y.createElement("path",{fill:"none",d:"M10.934 302.813v-10.728l131.358.01 131.358.01 15.636-1.955c8.6-1.076 15.786-1.805 15.968-1.621.182.184-1.236 5.887-3.152 12.674l-3.485 12.34H10.934Z"})),p||(p=y.createElement("path",{fill:"#eb9f2e",d:"M11.237 302.813v-10.728l132.573-.01 132.573-.01 12.453-1.519c14.274-1.741 15.793-1.814 15.794-.759 0 .422-1.407 5.939-3.128 12.26l-3.13 11.495H11.238Z"})),d||(d=y.createElement("path",{fill:"none",d:"M44.664 280.591c.009-.253 1.734-7.356 3.834-15.785l3.817-15.326 40.205-.157 40.205-.158v31.886h-44.04c-24.221 0-44.031-.207-44.021-.46zm28.34-11.294c1.408-1.335 1.898-4.63 1.03-6.916-.493-1.295-3.389-2.786-5.41-2.786-2.105 0-5.147 3.07-5.147 5.194 0 1.889 1.463 4.981 2.569 5.43 2.048.832 5.606.36 6.959-.922zm21.261 0c1.407-1.335 1.898-4.63 1.029-6.916-.493-1.295-3.389-2.786-5.41-2.786-2.105 0-5.147 3.07-5.147 5.194 0 1.889 1.463 4.981 2.569 5.43 2.049.832 5.606.36 6.959-.922zm20.992.12c1.898-1.506 2.42-4.01 1.367-6.554-.942-2.274-2.512-3.268-5.167-3.268-2.42 0-5.46 2.891-5.46 5.194 0 1.889 1.463 4.981 2.57 5.43 1.852.752 5.245.346 6.69-.802zm28.401-4.305v-15.938h20.653v31.876h-20.653z"})),u||(u=y.createElement("path",{fill:"#eb9f2e",d:"M175.852 265.112v-15.938h80.135l.6 2.299c.33 1.264 1.993 7.953 3.694 14.865 1.702 6.912 3.237 13.05 3.413 13.64.301 1.015-2.064 1.073-43.761 1.073h-44.08Zm24.73 4.138c1.832-2.02 2.163-3.777 1.165-6.189-1.626-3.926-5.907-4.728-8.933-1.674-1.989 2.007-2.257 4.073-.877 6.765 1.064 2.077 1.647 2.365 4.918 2.429 1.832.036 2.801-.31 3.727-1.33zm21.246 0c1.735-1.934 2.089-3.992 1.098-6.384-1.495-3.61-5.994-4.363-8.852-1.479-1.988 2.007-2.256 4.073-.877 6.765 1.064 2.077 1.647 2.365 4.918 2.429 1.836.036 2.796-.308 3.713-1.33zm21.259.047c1.038-.985 1.406-2.009 1.406-3.917 0-3.434-1.442-5.155-4.685-5.594-2.255-.305-2.757-.131-4.397 1.524-2.067 2.086-2.35 4.117-.954 6.842 1.06 2.067 1.651 2.365 4.833 2.429 1.666.034 2.817-.356 3.797-1.284zm-99.429-4.185v-15.938h20.653v31.876h-20.653zm-78.814 15.479c-10.775-.094-19.59-.408-19.59-.699 0-.797 7.103-29.51 7.366-29.774.125-.127 18.2-.322 40.166-.434l39.939-.204v31.571l-24.146-.145c-13.28-.079-32.961-.22-43.735-.315Zm7.764-10.585c1.609-.87 2.585-4.818 1.772-7.171-1.21-3.501-6.312-4.384-9.2-1.593-1.966 1.902-2.253 4.697-.776 7.579.84 1.64 1.212 1.808 3.988 1.808 1.684 0 3.58-.28 4.216-.623zm21.26 0c1.61-.87 2.585-4.818 1.772-7.171-1.21-3.501-6.312-4.384-9.2-1.593-1.966 1.902-2.253 4.697-.776 7.579.84 1.64 1.212 1.808 3.988 1.808 1.684 0 3.581-.28 4.216-.623zm21.833-.587c1.661-1.676 2.08-3.852 1.24-6.424-.847-2.588-2.125-3.4-5.354-3.4-4.654 0-7.006 4.654-4.663 9.226.855 1.668 1.184 1.808 4.252 1.808 2.501 0 3.623-.3 4.525-1.21z"})))};var ie=function(){for(var e,t,n,r=(e=(0,y.useState)({width:globalThis.innerWidth,height:globalThis.innerHeight}),t=e[0],n=e[1],(0,y.useEffect)((function(){var e=function(){n({width:window.innerWidth,height:window.innerHeight})};return window.addEventListener("resize",e),function(){window.removeEventListener("resize",e)}}),[]),t).width/16,a=[],i=0;i{n.d(t,{g:()=>h});var r=n(56632),a=n(82786),i=n(53800),o=n(49361),l=n(29901),c=n(43346);var s=function(e){var t=m[e];return'import {populateDemo} from "./populateDemo"\n(async () => {\n try {\n '+t[0]+"\n populateDemo("+t[1]+')\n } catch(e) {\n populateDemo({ \n type: {\n definition: ""\n },\n data: "",\n problems: "ParseError: " + e.originalErr.message\n } as any)\n }\n})()'},m={type:['const { user, data, problems } = await import("./type")',"{ type: user, data, problems }"],scope:['const { types, data, problems } = await import("./scope")',"{ type: types.package, data, problems }"],demo:['const { pkg, data, problems } = await import("./demo")',"{ type: pkg, data, problems }"]};var p={"index.html":'\n \n\n
\n
\n
\n

Definition

\n
\n
\n
\n
\n
\n

Output

\n
\n
\n
\n
\n',"demo.css":'body {\n font-family: "Cascadia Code", sans-serif;\n background-color: hsl(220 18% 10%);\n}\n\n#demo {\n display: flex;\n flex-direction: column;\n gap: 1rem;\n margin: -0.5rem;\n padding: 0.5rem;\n}\n\n#input {\n display: flex;\n flex-direction: row;\n flex-wrap: wrap;\n gap: 0.5rem;\n}\n\n.section {\n display: flex;\n flex-direction: column;\n flex-grow: 1;\n gap: 0.5rem;\n}\n\np {\n white-space: pre-wrap;\n}\n\npre {\n white-space: pre-wrap;\n}\n\nh3 {\n margin: 0px;\n color: #fffff0;\n}\n\n.key {\n color: #80cff8;\n}\n.val {\n color: #f5cf8f;\n}\n.operator {\n color: #eb9f2e;\n}\n.bracket {\n color: #009eff;\n}\n.card {\n padding: 1rem;\n background-color: rgb(18, 18, 18);\n color: rgb(255, 255, 255);\n /* transition: box-shadow 300ms cubic-bezier(0.4, 0, 0.2, 1) 0ms; */\n border-radius: 1rem;\n box-shadow: rgba(0, 0, 0, 0.2) 0px 2px 1px -1px,\n rgba(0, 0, 0, 0.14) 0px 1px 1px 0px, rgba(0, 0, 0, 0.12) 0px 1px 3px 0px;\n background-image: linear-gradient(\n rgba(255, 255, 255, 0.05),\n rgba(255, 255, 255, 0.05)\n );\n height: 100%;\n}\n',"populateDemo.ts":'import "./demo.css"\nimport type { Problems, Type } from "arktype"\nimport { stringify } from "arktype/internal/utils/serialize.js"\n\ntype PopulateDemoArgs = {\n type: Type\n data: unknown\n problems: Problems\n}\nexport const populateDemo = ({ data, type, problems }: PopulateDemoArgs) => {\n const defElement = document.querySelector("#definition")!\n defElement.textContent = stringify(type.definition, 2)\n defElement.innerHTML = recolor(defElement.innerHTML)\n\n const resultElement = document.querySelector("#output")!\n if (problems) {\n resultElement.textContent = `\u274c problems:\n\n${problems}`\n } else {\n resultElement.textContent = `\u2705 data:\n\n${stringify(data, 2)}`\n resultElement.innerHTML = recolor(resultElement.innerHTML)\n }\n}\n\nconst recolor = (input: string) => {\n const lines = input.split("\\n")\n const fixedInput: string[] = [""]\n for (const line of lines) {\n if (line.includes(":")) {\n const parts = line.split(":")\n fixedInput.push(`${buildKey(parts[0])}: ${buildVal(parts[1])}`)\n } else {\n fixedInput.push(addArkdarkStyles(line))\n }\n }\n fixedInput.push("")\n return fixedInput.join("\\n")\n}\n\nconst buildKey = (key: string) => {\n return `${key}`\n}\nconst buildVal = (val: string) => {\n const formatted = addArkdarkStyles(val.trim())\n if (formatted[formatted.length - 1] === ",") {\n return `${formatted.replace(",", "")},`\n } else if (formatted[formatted.length - 1] === "{") {\n return "{"\n }\n return `${formatted}`\n}\nconst addArkdarkStyles = (line: string) => {\n const brackets = ["[", "]", "(", ")"]\n const operators = [">", "<", ">e;", "<e;", "|"]\n let modifiedLine = line\n for (const bracket of brackets) {\n modifiedLine = modifiedLine.replaceAll(\n bracket,\n `${bracket}`\n )\n }\n for (const operator of operators) {\n modifiedLine = modifiedLine.replaceAll(\n operator,\n `${operator}`\n )\n }\n return modifiedLine\n}\n',"tsconfig.json":JSON.stringify({compilerOptions:{module:"esnext",target:"esnext",strict:!0}},null,4)},d={type:'import { type } from "arktype"\n\n// Definitions are statically parsed and inferred as TS.\nexport const user = type({\n name: "string",\n device: {\n platform: "\'android\'|\'ios\'",\n "version?": "number"\n }\n})\n\n// Validators return typed data or clear, customizable errors.\nexport const { data, problems } = user({\n name: "Alan Turing",\n device: {\n // problems.summary: "device/platform must be \'android\' or \'ios\' (was \'enigma\')"\n platform: "enigma"\n }\n})\n',scope:'import { scope } from "arktype"\n\n// Scopes are collections of types that can reference each other.\nexport const types = scope({\n package: {\n name: "string",\n "dependencies?": "package[]",\n "contributors?": "contributor[]"\n },\n contributor: {\n // Subtypes like \'email\' are inferred like \'string\' but provide additional validation at runtime.\n email: "email",\n "packages?": "package[]"\n }\n}).compile()\n\n// Cyclic types are inferred to arbitrary depth...\nexport type Package = typeof types.package.infer\n\n// And can validate cyclic data.\nconst packageData: Package = {\n name: "arktype",\n dependencies: [{ name: "typescript" }],\n contributors: [{ email: "david@sharktypeio" }]\n}\npackageData.dependencies![0].dependencies = [packageData]\n\nexport const { data, problems } = types.package(packageData)\n',demo:'import { type } from "arktype"\n\n// Define your type...\nexport const pkg = type({\n name: "string",\n version: "semver",\n "contributors?": "1{n.r(t),n.d(t,{default:()=>se});var r,a,i,o,l,c,s,m,p,d,u,f=n(43597),h=n(78099),g=n(2372),y=n(29901),b=n(63221),v=n(53800),E=n(85569),k=n(54805),x=n(55850),w=n(68584),Z=n(70856),z=function(e){return y.createElement("video",(0,k.Z)({autoPlay:!0,loop:!0,controls:!0,playsInline:!0,muted:!0,disablePictureInPicture:!0},e))},T=n(14043),C=function(){return(0,T.Z)("(max-width:1250px)")},I=y.createElement("div",{className:"inferable-code"},y.createElement(Z.Z,{language:"typescript"},'const user = type({\n name: "string",\n device: {\n platform: "\'android\'|\'ios\'",\n "version?": "number"\n }\n})\n\n\n// Hover to infer...\ntype User = typeof user.infer\n'),y.createElement("img",{height:"50%",src:"/img/isomorphicHover.png"})),S=y.createElement("div",{className:"inferable-code"},y.createElement(Z.Z,{language:"typescript"},"// Hover to infer...\n",'const arkUser = type({\n name: /^ark.*$/ as Infer<`ark${string}`>,\n birthday: morph("string", (s) => new Date(s)),\n "powerLevel?": "1<=number<9000"\n})'),y.createElement("img",{height:"60%",src:"/img/arkUser.png"})),H=y.createElement("div",{className:"inferable-code"},y.createElement(Z.Z,{language:"typescript"},"// Hover to infer...\n",'const zodUser = z.object({\n name: z.custom<`zod${string}`>(\n (val) => typeof val === "string" && /^zod.*$/.test(val)\n ),\n birthday: z.preprocess(\n (arg) => (typeof arg === "string" ? new Date(arg) : undefined),\n z.date()\n ),\n powerLevel: z.number().gte(1).lt(9000).optional()\n})'),y.createElement("img",{height:"80%",src:"/img/zodInfer.png"})),O=y.createElement(y.Fragment,null,S,H),j=y.createElement("div",{className:"inferable-code"},y.createElement(Z.Z,{language:"typescript"},"// Hover to see internal representation...\n","export const deepLeftOrRight = union(\n {\n auto: {\n discriminated: \"'left'\"\n }\n },\n {\n auto: {\n discriminated: \"'right'\"\n }\n }\n)"),y.createElement("img",{src:"/img/optimizedUnion.png"})),D=y.createElement("div",{className:"inferable-code"},y.createElement(Z.Z,{language:"typescript"},"// Hover to see internal representation...\n",'export const numericIntersection = type(\n "(1 <= number%2 < 100) & (0 < number%3 <= 99)"\n)',"\n \n\n\n\n\n"),y.createElement("img",{src:"/img/optimizedNumber.png"})),M=[{title:"Isomorphic",description:"Define types using TS syntax. Infer them 1:1. Use them to validate your data at runtime.",image:I},{title:"Concise",description:"Say more with less",image:O},{title:"Optimized",description:"ArkType is not just a validator\u2014 it's a full type system. Operations are deeply computed and optimized by default",image:y.createElement(y.Fragment,null,j,D)},{title:"Type-safe",description:"String definitions are statically parsed with each character you type and give detailed feedback just like in your editor.",image:y.createElement(v.Z,{width:"100%"},y.createElement(z,{src:"/img/typePerf.mp4"}),y.createElement("caption",{style:{fontSize:".8rem"}},"Worried about performance? Don't be. This is how it feels to interact with a scope of 100 cyclic types (you may want to go fullscreen to see the details!)"))}],P=function(){return y.createElement(x.ZP,{sx:{alignContent:"center"},columns:C()?1:2,spacing:3},M.map((function(e,t){return y.createElement(L,(0,k.Z)({key:t},e))})))},L=function(e){var t,n=(0,w.Z)();return y.createElement(v.Z,{spacing:2,maxWidth:"40em"},y.createElement(E.Z,{component:"h3",variant:"h5",fontWeight:"700",width:"100%",textAlign:"center",color:n.palette.info.main},e.title),y.createElement(E.Z,{component:"p",variant:"body1",fontWeight:"300",minHeight:"3rem"},e.description),y.createElement("div",{style:{padding:"6px",borderRadius:"16px"}},null!=(t=e.image)?t:null))},N=n(96172),$=n(36832),A=n(50931),F=n(73760),W=n(35601),U=n(76570),q=n(17188),R=n(39069),V=function(){var e=(0,N.TH)().pathname,t=(0,w.Z)().palette,n="dark"===(0,b.I)().colorMode,r=(0,y.useState)(e.includes("try")),a=r[0],i=r[1],o=n?"#ffffff00":"#000000aa";return y.createElement(y.Fragment,null,y.createElement(v.Z,{alignItems:"start",width:"100%"},y.createElement(F.Z,{variant:"contained",sx:{backgroundColor:o,backdropFilter:"blur(4px)",borderRadius:"2rem",fontSize:"1.5rem",fontFamily:'"Cascadia Code", sans-serif',textTransform:"none",color:t.primary.main,"&:hover":{backgroundColor:o,color:t.secondary.main,backdropFilter:"blur(6px)"},zIndex:1},onClick:function(){return i(!a)},endIcon:y.createElement("div",{style:{display:"flex"}},a?y.createElement($.Z,null):y.createElement(A.Z,null))},a?"$ wq!":"$ code demo.ts",y.createElement(W.E.div,{animate:{opacity:0},transition:{duration:.5,repeatType:"mirror",repeat:1/0}},"_"))),y.createElement(v.Z,{width:"100%"},a?y.createElement(U.g,{embedId:"demo"}):y.createElement(z,{src:"/img/arktype.mp4",style:{width:"100%",marginTop:"-2.8rem"}})),y.createElement("sub",{style:{marginLeft:"2.3px",marginTop:"5px"}},y.createElement("code",null,"typescript@4.9.5")," in VS Code\u2014 no extensions or plugins required (",y.createElement("a",{href:"https://github.com/arktypeio/arktype#how",target:"_blank"},"how?"),")"))},_=n(47699),J=n(54852),G=n(17739),K=n(57487),B=n(84123),Y=function(){var e=(0,K.v)().scrollY,t=(0,B._)(),n={position:"absolute",top:60,width:386};return e.onChange((function(e){t.start(e?{position:"fixed",top:"50%",width:340}:n)})),y.createElement(W.E.div,{style:{right:0},initial:n,animate:t},y.createElement(X,null))},Q=function(){return y.createElement("div",{style:{width:"100%"}},y.createElement(X,null))},X=function(){return y.createElement(_.Z,{style:{height:"8rem",margin:".5rem",padding:".7rem 1rem 0rem",backgroundColor:"#ffffff00",backdropFilter:"blur(1px)",borderRadius:"2rem",zIndex:1,fontFamily:'"Cascadia Code", sans-serif'},elevation:8},y.createElement(G.Z,{className:"installationTabs"},y.createElement(J.Z,{value:"node",default:!0},y.createElement(G.Z,{className:"subTabs"},y.createElement(J.Z,{value:"npm",attributes:{className:"npmTab"}},y.createElement(Z.Z,{language:"bash"},"npm install arktype")),y.createElement(J.Z,{value:"pnpm",attributes:{className:"pnpmTab"}},y.createElement(Z.Z,{language:"bash"},"pnpm add arktype")),y.createElement(J.Z,{value:"yarn",attributes:{className:"yarnTab"}},y.createElement(Z.Z,{language:"bash"},"yarn add arktype")))),y.createElement(J.Z,{value:"bun",label:"bun"},y.createElement(Z.Z,{language:"bash"},"bun install arktype")),y.createElement(J.Z,{value:"deno",label:"deno"},y.createElement(Z.Z,{language:"typescript"},'import { type } from "npm:arktype"'))))},ee=function(){var e=(0,b.I)().colorMode;return y.createElement("main",{style:{display:"flex",justifyContent:"center"}},y.createElement(v.Z,{justifyContent:"center",padding:"1rem 0rem 1rem",spacing:1,width:"100%",maxWidth:"60rem"},y.createElement(V,null),(0,T.Z)("(min-width:1420px)")?y.createElement(Y,null):y.createElement(Q,null),y.createElement(E.Z,{color:"dark"===e?"primary.light":"primary.dark",className:"contents",fontSize:"1.3rem"},y.createElement("p",null,"ArkType is a runtime validation library that can infer"," ",y.createElement("b",null,"TypeScript definitions 1:1")," and reuse them as"," ",y.createElement("b",null,"highly-optimized validators")," for your data."),y.createElement("p",null,"With each character you type, you'll get"," ",y.createElement("b",null,"immediate feedback from your editor")," in the form of either a fully-inferred ",y.createElement("code",null,"Type")," or a specific and helpful ",y.createElement("code",null,"ParseError"),"."),y.createElement("p",null,"This result exactly mirrors what you can expect to happen at runtime down to the punctuation of the error message- ",y.createElement("b",null,"no plugins required"),".")),y.createElement(P,null)))},te=["title","titleId"];function ne(){return ne=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}const ae=function(e){var t=e.title,n=e.titleId,f=re(e,te);return y.createElement("svg",ne({viewBox:"0 0 375 375","aria-labelledby":n},f),t?y.createElement("title",{id:n},t):null,r||(r=y.createElement("path",{fill:"#4b3621",d:"M5.314 281.357h27.799l9.62-38.835a5.288 5.337 0 0 1 5.156-4.077h212.609a5.288 5.337 0 0 1 5.156 4.077l9.461 38.3 37.844-4.775c1.754-.268 3.508.43 4.678 1.824 1.169 1.34 1.542 3.218 1.063 4.935l-10.63 37.548a5.295 5.344 0 0 1-5.103 3.916H5.315c-2.923 0-5.316-2.414-5.316-5.364V286.72c0-2.95 2.391-5.364 5.315-5.364Zm127.566-32.184H52.035l-7.972 32.184h88.817zm31.89 0h-21.26v32.184h21.26zm91.582 0h-80.95v32.184h88.923zM10.63 313.542h288.35l7.283-25.855-34.55 4.344c-.212.054-.425.054-.637.054H10.629v21.457z"})),a||(a=y.createElement("path",{fill:"none",d:"M106.994 267.84a5.281 5.33 0 0 0 4.624 2.789c.904 0 1.754-.215 2.604-.697a5.358 5.358 0 0 0 2.073-7.296c-1.435-2.574-4.624-3.54-7.229-2.092-2.55 1.449-3.507 4.72-2.072 7.296zm-43.212-2.575c0 2.95 2.338 5.364 5.262 5.364h.052c2.924 0 5.316-2.414 5.316-5.364 0-2.95-2.392-5.364-5.316-5.364-2.923 0-5.314 2.413-5.314 5.364zm127.671.805c.425 2.628 2.658 4.56 5.262 4.56.266 0 .531 0 .797-.054 2.87-.43 4.943-3.165 4.465-6.115-.426-2.95-3.083-4.989-6.006-4.506h-.053c-2.87.428-4.89 3.165-4.465 6.114zm21.155-.805c0 2.95 2.391 5.364 5.315 5.364 2.924 0 5.369-2.414 5.369-5.364 0-2.95-2.392-5.364-5.316-5.364h-.053c-2.923 0-5.315 2.413-5.315 5.364zm-127.566 0c0 2.95 2.339 5.364 5.262 5.364h.053c2.923 0 5.316-2.414 5.316-5.364 0-2.95-2.392-5.364-5.316-5.364s-5.315 2.413-5.315 5.364zm152.866 5.203a5.232 5.28 0 0 0 1.276.161 5.284 5.284 0 0 0 5.156-4.077c.744-2.843-.957-5.793-3.827-6.49h-.053c-2.87-.698-5.74 1.018-6.432 3.916a5.39 5.39 0 0 0 3.88 6.49z"})),i||(i=y.createElement("path",{fill:"none",d:"M182.736 249.173h73.616l6.644 26.82h-80.26Zm55.172 21.295a5.232 5.28 0 0 0 1.276.161 5.284 5.284 0 0 0 5.156-4.077c.744-2.843-.957-5.793-3.827-6.49h-.053c-2.87-.698-5.74 1.018-6.432 3.916a5.39 5.39 0 0 0 3.88 6.49zm-19.985.161c2.923 0 5.369-2.414 5.369-5.364 0-2.95-2.392-5.364-5.316-5.364h-.053c-2.923 0-5.315 2.413-5.315 5.364 0 2.95 2.392 5.364 5.315 5.364zm-21.208 0c.266 0 .532 0 .798-.053 2.87-.43 4.943-3.165 4.464-6.115-.425-2.95-3.082-4.989-6.006-4.506h-.053c-2.87.43-4.89 3.165-4.464 6.115.424 2.627 2.657 4.56 5.262 4.56z"})),o||(o=y.createElement("path",{fill:"none",d:"M182.736 249.173v26.82h80.26l1.329 5.364H175.4v-32.184zm-17.966 0h-13.925v26.82h13.925z"})),l||(l=y.createElement("path",{fill:"none",d:"M150.845 249.173v26.82h13.925v5.364h-21.26v-32.184zm-92.805 0h74.84v26.82H51.397Zm48.954 18.667a5.281 5.33 0 0 0 4.624 2.789c.904 0 1.754-.215 2.604-.697a5.358 5.358 0 0 0 2.073-7.296c-1.435-2.574-4.624-3.54-7.229-2.092-2.55 1.449-3.507 4.72-2.072 7.296zm-16.69 2.79h.053c2.923 0 5.316-2.415 5.316-5.365s-2.392-5.364-5.316-5.364-5.315 2.413-5.315 5.364c0 2.95 2.34 5.364 5.262 5.364zm-21.26 0h.052c2.924 0 5.316-2.415 5.316-5.365s-2.392-5.364-5.316-5.364c-2.923 0-5.315 2.413-5.315 5.364 0 2.95 2.34 5.364 5.262 5.364z"})),c||(c=y.createElement("path",{fill:"none",d:"M52.035 249.173h6.006l-6.644 26.82h81.483v5.364H44.062Zm-34.071 42.912h253.111c.213 0 .426 0 .638-.053l34.55-4.345-5.773 20.49H17.964Z"})),s||(s=y.createElement("path",{fill:"none",d:"m300.49 308.178-1.51 5.364zM17.964 292.085v16.093H300.49l-1.51 5.364H10.63v-21.457z"})),m||(m=y.createElement("path",{fill:"none",d:"M10.934 302.813v-10.728l131.358.01 131.358.01 15.636-1.955c8.6-1.076 15.786-1.805 15.968-1.621.182.184-1.236 5.887-3.152 12.674l-3.485 12.34H10.934Z"})),p||(p=y.createElement("path",{fill:"#eb9f2e",d:"M11.237 302.813v-10.728l132.573-.01 132.573-.01 12.453-1.519c14.274-1.741 15.793-1.814 15.794-.759 0 .422-1.407 5.939-3.128 12.26l-3.13 11.495H11.238Z"})),d||(d=y.createElement("path",{fill:"none",d:"M44.664 280.591c.009-.253 1.734-7.356 3.834-15.785l3.817-15.326 40.205-.157 40.205-.158v31.886h-44.04c-24.221 0-44.031-.207-44.021-.46zm28.34-11.294c1.408-1.335 1.898-4.63 1.03-6.916-.493-1.295-3.389-2.786-5.41-2.786-2.105 0-5.147 3.07-5.147 5.194 0 1.889 1.463 4.981 2.569 5.43 2.048.832 5.606.36 6.959-.922zm21.261 0c1.407-1.335 1.898-4.63 1.029-6.916-.493-1.295-3.389-2.786-5.41-2.786-2.105 0-5.147 3.07-5.147 5.194 0 1.889 1.463 4.981 2.569 5.43 2.049.832 5.606.36 6.959-.922zm20.992.12c1.898-1.506 2.42-4.01 1.367-6.554-.942-2.274-2.512-3.268-5.167-3.268-2.42 0-5.46 2.891-5.46 5.194 0 1.889 1.463 4.981 2.57 5.43 1.852.752 5.245.346 6.69-.802zm28.401-4.305v-15.938h20.653v31.876h-20.653z"})),u||(u=y.createElement("path",{fill:"#eb9f2e",d:"M175.852 265.112v-15.938h80.135l.6 2.299c.33 1.264 1.993 7.953 3.694 14.865 1.702 6.912 3.237 13.05 3.413 13.64.301 1.015-2.064 1.073-43.761 1.073h-44.08Zm24.73 4.138c1.832-2.02 2.163-3.777 1.165-6.189-1.626-3.926-5.907-4.728-8.933-1.674-1.989 2.007-2.257 4.073-.877 6.765 1.064 2.077 1.647 2.365 4.918 2.429 1.832.036 2.801-.31 3.727-1.33zm21.246 0c1.735-1.934 2.089-3.992 1.098-6.384-1.495-3.61-5.994-4.363-8.852-1.479-1.988 2.007-2.256 4.073-.877 6.765 1.064 2.077 1.647 2.365 4.918 2.429 1.836.036 2.796-.308 3.713-1.33zm21.259.047c1.038-.985 1.406-2.009 1.406-3.917 0-3.434-1.442-5.155-4.685-5.594-2.255-.305-2.757-.131-4.397 1.524-2.067 2.086-2.35 4.117-.954 6.842 1.06 2.067 1.651 2.365 4.833 2.429 1.666.034 2.817-.356 3.797-1.284zm-99.429-4.185v-15.938h20.653v31.876h-20.653zm-78.814 15.479c-10.775-.094-19.59-.408-19.59-.699 0-.797 7.103-29.51 7.366-29.774.125-.127 18.2-.322 40.166-.434l39.939-.204v31.571l-24.146-.145c-13.28-.079-32.961-.22-43.735-.315Zm7.764-10.585c1.609-.87 2.585-4.818 1.772-7.171-1.21-3.501-6.312-4.384-9.2-1.593-1.966 1.902-2.253 4.697-.776 7.579.84 1.64 1.212 1.808 3.988 1.808 1.684 0 3.58-.28 4.216-.623zm21.26 0c1.61-.87 2.585-4.818 1.772-7.171-1.21-3.501-6.312-4.384-9.2-1.593-1.966 1.902-2.253 4.697-.776 7.579.84 1.64 1.212 1.808 3.988 1.808 1.684 0 3.581-.28 4.216-.623zm21.833-.587c1.661-1.676 2.08-3.852 1.24-6.424-.847-2.588-2.125-3.4-5.354-3.4-4.654 0-7.006 4.654-4.663 9.226.855 1.668 1.184 1.808 4.252 1.808 2.501 0 3.623-.3 4.525-1.21z"})))};var ie=function(){for(var e,t,n,r=(e=(0,y.useState)({width:globalThis.innerWidth,height:globalThis.innerHeight}),t=e[0],n=e[1],(0,y.useEffect)((function(){var e=function(){n({width:window.innerWidth,height:window.innerHeight})};return window.addEventListener("resize",e),function(){window.removeEventListener("resize",e)}}),[]),t).width/16,a=[],i=0;i{t.d(n,{Zo:()=>c,kt:()=>f});var r=t(29901);function a(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function o(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function i(e){for(var n=1;n=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var p=r.createContext({}),l=function(e){var n=r.useContext(p),t=n;return e&&(t="function"==typeof e?e(n):i(i({},n),e)),t},c=function(e){var n=l(e.components);return r.createElement(p.Provider,{value:n},e.children)},d="mdxType",m={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},u=r.forwardRef((function(e,n){var t=e.components,a=e.mdxType,o=e.originalType,p=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),d=l(t),u=a,f=d["".concat(p,".").concat(u)]||d[u]||m[u]||o;return t?r.createElement(f,i(i({ref:n},c),{},{components:t})):r.createElement(f,i({ref:n},c))}));function f(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var o=t.length,i=new Array(o);i[0]=u;var s={};for(var p in n)hasOwnProperty.call(n,p)&&(s[p]=n[p]);s.originalType=e,s[d]="string"==typeof e?e:a,i[1]=s;for(var l=2;l{t.d(n,{g:()=>y});var r=t(56632),a=t(82786),o=t(53800),i=t(49361),s=t(29901),p=t(43346);var l=function(e){var n=c[e];return'import {populateDemo} from "./populateDemo"\n(async () => {\n try {\n '+n[0]+"\n populateDemo("+n[1]+')\n } catch(e) {\n populateDemo({ \n type: {\n definition: ""\n },\n data: "",\n problems: "ParseError: " + e.originalErr.message\n } as any)\n }\n})()'},c={type:['const { user, data, problems } = await import("./type")',"{ type: user, data, problems }"],scope:['const { types, data, problems } = await import("./scope")',"{ type: types.package, data, problems }"],demo:['const { pkg, data, problems } = await import("./demo")',"{ type: pkg, data, problems }"]};var d={"index.html":'\n \n\n
\n
\n
\n

Definition

\n
\n
\n
\n
\n
\n

Output

\n
\n
\n
\n
\n',"demo.css":'body {\n font-family: "Cascadia Code", sans-serif;\n background-color: hsl(220 18% 10%);\n}\n\n#demo {\n display: flex;\n flex-direction: column;\n gap: 1rem;\n margin: -0.5rem;\n padding: 0.5rem;\n}\n\n#input {\n display: flex;\n flex-direction: row;\n flex-wrap: wrap;\n gap: 0.5rem;\n}\n\n.section {\n display: flex;\n flex-direction: column;\n flex-grow: 1;\n gap: 0.5rem;\n}\n\np {\n white-space: pre-wrap;\n}\n\npre {\n white-space: pre-wrap;\n}\n\nh3 {\n margin: 0px;\n color: #fffff0;\n}\n\n.key {\n color: #80cff8;\n}\n.val {\n color: #f5cf8f;\n}\n.operator {\n color: #eb9f2e;\n}\n.bracket {\n color: #009eff;\n}\n.card {\n padding: 1rem;\n background-color: rgb(18, 18, 18);\n color: rgb(255, 255, 255);\n /* transition: box-shadow 300ms cubic-bezier(0.4, 0, 0.2, 1) 0ms; */\n border-radius: 1rem;\n box-shadow: rgba(0, 0, 0, 0.2) 0px 2px 1px -1px,\n rgba(0, 0, 0, 0.14) 0px 1px 1px 0px, rgba(0, 0, 0, 0.12) 0px 1px 3px 0px;\n background-image: linear-gradient(\n rgba(255, 255, 255, 0.05),\n rgba(255, 255, 255, 0.05)\n );\n height: 100%;\n}\n',"populateDemo.ts":'import "./demo.css"\nimport type { Problems, Type } from "arktype"\nimport { stringify } from "arktype/internal/utils/serialize.js"\n\ntype PopulateDemoArgs = {\n type: Type\n data: unknown\n problems: Problems\n}\nexport const populateDemo = ({ data, type, problems }: PopulateDemoArgs) => {\n const defElement = document.querySelector("#definition")!\n defElement.textContent = stringify(type.definition, 2)\n defElement.innerHTML = recolor(defElement.innerHTML)\n\n const resultElement = document.querySelector("#output")!\n if (problems) {\n resultElement.textContent = `\u274c problems:\n\n${problems}`\n } else {\n resultElement.textContent = `\u2705 data:\n\n${stringify(data, 2)}`\n resultElement.innerHTML = recolor(resultElement.innerHTML)\n }\n}\n\nconst recolor = (input: string) => {\n const lines = input.split("\\n")\n const fixedInput: string[] = [""]\n for (const line of lines) {\n if (line.includes(":")) {\n const parts = line.split(":")\n fixedInput.push(`${buildKey(parts[0])}: ${buildVal(parts[1])}`)\n } else {\n fixedInput.push(addArkdarkStyles(line))\n }\n }\n fixedInput.push("")\n return fixedInput.join("\\n")\n}\n\nconst buildKey = (key: string) => {\n return `${key}`\n}\nconst buildVal = (val: string) => {\n const formatted = addArkdarkStyles(val.trim())\n if (formatted[formatted.length - 1] === ",") {\n return `${formatted.replace(",", "")},`\n } else if (formatted[formatted.length - 1] === "{") {\n return "{"\n }\n return `${formatted}`\n}\nconst addArkdarkStyles = (line: string) => {\n const brackets = ["[", "]", "(", ")"]\n const operators = [">", "<", ">e;", "<e;", "|"]\n let modifiedLine = line\n for (const bracket of brackets) {\n modifiedLine = modifiedLine.replaceAll(\n bracket,\n `${bracket}`\n )\n }\n for (const operator of operators) {\n modifiedLine = modifiedLine.replaceAll(\n operator,\n `${operator}`\n )\n }\n return modifiedLine\n}\n',"tsconfig.json":JSON.stringify({compilerOptions:{module:"esnext",target:"esnext",strict:!0}},null,4)},m={type:'import { type } from "arktype"\n\n// Definitions are statically parsed and inferred as TS.\nexport const user = type({\n name: "string",\n device: {\n platform: "\'android\'|\'ios\'",\n "version?": "number"\n }\n})\n\n// Validators return typed data or clear, customizable errors.\nexport const { data, problems } = user({\n name: "Alan Turing",\n device: {\n // problems.summary: "device/platform must be \'android\' or \'ios\' (was \'enigma\')"\n platform: "enigma"\n }\n})\n',scope:'import { scope } from "arktype"\n\n// Scopes are collections of types that can reference each other.\nexport const types = scope({\n package: {\n name: "string",\n "dependencies?": "package[]",\n "contributors?": "contributor[]"\n },\n contributor: {\n // Subtypes like \'email\' are inferred like \'string\' but provide additional validation at runtime.\n email: "email",\n "packages?": "package[]"\n }\n}).compile()\n\n// Cyclic types are inferred to arbitrary depth...\nexport type Package = typeof types.package.infer\n\n// And can validate cyclic data.\nconst packageData: Package = {\n name: "arktype",\n dependencies: [{ name: "typescript" }],\n contributors: [{ email: "david@sharktypeio" }]\n}\npackageData.dependencies![0].dependencies = [packageData]\n\nexport const { data, problems } = types.package(packageData)\n',demo:'import { type } from "arktype"\n\n// Define your type...\nexport const pkg = type({\n name: "string",\n version: "semver",\n "contributors?": "1{t.r(n),t.d(n,{assets:()=>d,contentTitle:()=>l,default:()=>y,frontMatter:()=>p,metadata:()=>c,toc:()=>m});var r=t(54805),a=t(30008),o=(t(29901),t(57522)),i=t(76570),s=["components"],p={id:"intro",hide_table_of_contents:!0,title:"Intro"},l="Getting Started",c={unversionedId:"intro",id:"intro",title:"Intro",description:'replace(./dev/arktype.io/static,) |> replace({ type },{"{"} type {"}"}) --\x3e',source:"@site/docs/index.mdx",sourceDirName:".",slug:"/",permalink:"/docs/next/",draft:!1,tags:[],version:"current",frontMatter:{id:"intro",hide_table_of_contents:!0,title:"Intro"},sidebar:"sidebar",next:{title:"Scopes",permalink:"/docs/next/scopes"}},d={},m=[{value:"Install \ud83d\udce612KB gzipped, 0 dependencies",id:"install-12kb-gzipped-0-dependencies",level:2},{value:"Your first type",id:"your-first-type",level:2}],u={toc:m},f="wrapper";function y(e){var n=e.components,t=(0,a.Z)(e,s);return(0,o.kt)(f,(0,r.Z)({},u,t,{components:n,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"getting-started"},"Getting Started"),(0,o.kt)("h2",{id:"install-12kb-gzipped-0-dependencies"},"Install ",(0,o.kt)("sub",null,(0,o.kt)("sub",null,"\ud83d\udce6",(0,o.kt)("inlineCode",{parentName:"h2"},"12KB")," gzipped, ",(0,o.kt)("inlineCode",{parentName:"h2"},"0")," dependencies"))),(0,o.kt)("img",{src:"/img/npm.svg",alt:"Npm Icon",height:"16px"})," ",(0,o.kt)("code",null,"npm install arktype"),(0,o.kt)("sub",null,"(or whatever package manager you prefer)"),(0,o.kt)("br",null),(0,o.kt)("p",null,"Our types are tested in ",(0,o.kt)("a",{parentName:"p",href:"https://www.typescriptlang.org/tsconfig#strict"},"strict-mode")," with TypeScript versions ",(0,o.kt)("inlineCode",{parentName:"p"},"4.8"),", ",(0,o.kt)("inlineCode",{parentName:"p"},"4.9"),", and ",(0,o.kt)("inlineCode",{parentName:"p"},"5.0"),"."),(0,o.kt)("p",null,(0,o.kt)("em",{parentName:"p"},"Our APIs have mostly stabilized, but details may still change during the alpha/beta stages of our 1.0 release. If you have suggestions that may require a breaking change, now is the time to let us know!")," \u26f5"),(0,o.kt)("h2",{id:"your-first-type"},"Your first type"),(0,o.kt)(i.g,{embedId:"type",mdxType:"StackBlitzDemo"}))}y.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkarktype_io=self.webpackChunkarktype_io||[]).push([[4173],{57522:(e,n,t)=>{t.d(n,{Zo:()=>c,kt:()=>f});var r=t(29901);function a(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function o(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function i(e){for(var n=1;n=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var p=r.createContext({}),l=function(e){var n=r.useContext(p),t=n;return e&&(t="function"==typeof e?e(n):i(i({},n),e)),t},c=function(e){var n=l(e.components);return r.createElement(p.Provider,{value:n},e.children)},d="mdxType",m={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},u=r.forwardRef((function(e,n){var t=e.components,a=e.mdxType,o=e.originalType,p=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),d=l(t),u=a,f=d["".concat(p,".").concat(u)]||d[u]||m[u]||o;return t?r.createElement(f,i(i({ref:n},c),{},{components:t})):r.createElement(f,i({ref:n},c))}));function f(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var o=t.length,i=new Array(o);i[0]=u;var s={};for(var p in n)hasOwnProperty.call(n,p)&&(s[p]=n[p]);s.originalType=e,s[d]="string"==typeof e?e:a,i[1]=s;for(var l=2;l{t.d(n,{g:()=>y});var r=t(56632),a=t(82786),o=t(53800),i=t(49361),s=t(29901),p=t(43346);var l=function(e){var n=c[e];return'import {populateDemo} from "./populateDemo"\n(async () => {\n try {\n '+n[0]+"\n populateDemo("+n[1]+')\n } catch(e) {\n populateDemo({ \n type: {\n definition: ""\n },\n data: "",\n problems: "ParseError: " + e.originalErr.message\n } as any)\n }\n})()'},c={type:['const { user, data, problems } = await import("./type")',"{ type: user, data, problems }"],scope:['const { types, data, problems } = await import("./scope")',"{ type: types.package, data, problems }"],demo:['const { pkg, data, problems } = await import("./demo")',"{ type: pkg, data, problems }"]};var d={"index.html":'\n \n\n
\n
\n
\n

Definition

\n
\n
\n
\n
\n
\n

Output

\n
\n
\n
\n
\n',"demo.css":'body {\n font-family: "Cascadia Code", sans-serif;\n background-color: hsl(220 18% 10%);\n}\n\n#demo {\n display: flex;\n flex-direction: column;\n gap: 1rem;\n margin: -0.5rem;\n padding: 0.5rem;\n}\n\n#input {\n display: flex;\n flex-direction: row;\n flex-wrap: wrap;\n gap: 0.5rem;\n}\n\n.section {\n display: flex;\n flex-direction: column;\n flex-grow: 1;\n gap: 0.5rem;\n}\n\np {\n white-space: pre-wrap;\n}\n\npre {\n white-space: pre-wrap;\n}\n\nh3 {\n margin: 0px;\n color: #fffff0;\n}\n\n.key {\n color: #80cff8;\n}\n.val {\n color: #f5cf8f;\n}\n.operator {\n color: #eb9f2e;\n}\n.bracket {\n color: #009eff;\n}\n.card {\n padding: 1rem;\n background-color: rgb(18, 18, 18);\n color: rgb(255, 255, 255);\n /* transition: box-shadow 300ms cubic-bezier(0.4, 0, 0.2, 1) 0ms; */\n border-radius: 1rem;\n box-shadow: rgba(0, 0, 0, 0.2) 0px 2px 1px -1px,\n rgba(0, 0, 0, 0.14) 0px 1px 1px 0px, rgba(0, 0, 0, 0.12) 0px 1px 3px 0px;\n background-image: linear-gradient(\n rgba(255, 255, 255, 0.05),\n rgba(255, 255, 255, 0.05)\n );\n height: 100%;\n}\n',"populateDemo.ts":'import "./demo.css"\nimport type { Problems, Type } from "arktype"\nimport { stringify } from "arktype/internal/utils/serialize.js"\n\ntype PopulateDemoArgs = {\n type: Type\n data: unknown\n problems: Problems\n}\nexport const populateDemo = ({ data, type, problems }: PopulateDemoArgs) => {\n const defElement = document.querySelector("#definition")!\n defElement.textContent = stringify(type.definition, 2)\n defElement.innerHTML = recolor(defElement.innerHTML)\n\n const resultElement = document.querySelector("#output")!\n if (problems) {\n resultElement.textContent = `\u274c problems:\n\n${problems}`\n } else {\n resultElement.textContent = `\u2705 data:\n\n${stringify(data, 2)}`\n resultElement.innerHTML = recolor(resultElement.innerHTML)\n }\n}\n\nconst recolor = (input: string) => {\n const lines = input.split("\\n")\n const fixedInput: string[] = [""]\n for (const line of lines) {\n if (line.includes(":")) {\n const parts = line.split(":")\n fixedInput.push(`${buildKey(parts[0])}: ${buildVal(parts[1])}`)\n } else {\n fixedInput.push(addArkdarkStyles(line))\n }\n }\n fixedInput.push("")\n return fixedInput.join("\\n")\n}\n\nconst buildKey = (key: string) => {\n return `${key}`\n}\nconst buildVal = (val: string) => {\n const formatted = addArkdarkStyles(val.trim())\n if (formatted[formatted.length - 1] === ",") {\n return `${formatted.replace(",", "")},`\n } else if (formatted[formatted.length - 1] === "{") {\n return "{"\n }\n return `${formatted}`\n}\nconst addArkdarkStyles = (line: string) => {\n const brackets = ["[", "]", "(", ")"]\n const operators = [">", "<", ">e;", "<e;", "|"]\n let modifiedLine = line\n for (const bracket of brackets) {\n modifiedLine = modifiedLine.replaceAll(\n bracket,\n `${bracket}`\n )\n }\n for (const operator of operators) {\n modifiedLine = modifiedLine.replaceAll(\n operator,\n `${operator}`\n )\n }\n return modifiedLine\n}\n',"tsconfig.json":JSON.stringify({compilerOptions:{module:"esnext",target:"esnext",strict:!0}},null,4)},m={type:'import { type } from "arktype"\n\n// Definitions are statically parsed and inferred as TS.\nexport const user = type({\n name: "string",\n device: {\n platform: "\'android\'|\'ios\'",\n "version?": "number"\n }\n})\n\n// Validators return typed data or clear, customizable errors.\nexport const { data, problems } = user({\n name: "Alan Turing",\n device: {\n // problems.summary: "device/platform must be \'android\' or \'ios\' (was \'enigma\')"\n platform: "enigma"\n }\n})\n',scope:'import { scope } from "arktype"\n\n// Scopes are collections of types that can reference each other.\nexport const types = scope({\n package: {\n name: "string",\n "dependencies?": "package[]",\n "contributors?": "contributor[]"\n },\n contributor: {\n // Subtypes like \'email\' are inferred like \'string\' but provide additional validation at runtime.\n email: "email",\n "packages?": "package[]"\n }\n}).compile()\n\n// Cyclic types are inferred to arbitrary depth...\nexport type Package = typeof types.package.infer\n\n// And can validate cyclic data.\nconst packageData: Package = {\n name: "arktype",\n dependencies: [{ name: "typescript" }],\n contributors: [{ email: "david@sharktypeio" }]\n}\npackageData.dependencies![0].dependencies = [packageData]\n\nexport const { data, problems } = types.package(packageData)\n',demo:'import { type } from "arktype"\n\n// Define your type...\nexport const pkg = type({\n name: "string",\n version: "semver",\n "contributors?": "1{t.r(n),t.d(n,{assets:()=>d,contentTitle:()=>l,default:()=>y,frontMatter:()=>p,metadata:()=>c,toc:()=>m});var r=t(54805),a=t(30008),o=(t(29901),t(57522)),i=t(76570),s=["components"],p={id:"intro",hide_table_of_contents:!0,title:"Intro"},l="Getting Started",c={unversionedId:"intro",id:"intro",title:"Intro",description:'replace(./dev/arktype.io/static,) |> replace({ type },{"{"} type {"}"}) --\x3e',source:"@site/docs/index.mdx",sourceDirName:".",slug:"/",permalink:"/docs/next/",draft:!1,tags:[],version:"current",frontMatter:{id:"intro",hide_table_of_contents:!0,title:"Intro"},sidebar:"sidebar",next:{title:"Scopes",permalink:"/docs/next/scopes"}},d={},m=[{value:"Install \ud83d\udce612KB gzipped, 0 dependencies",id:"install-12kb-gzipped-0-dependencies",level:2},{value:"Your first type",id:"your-first-type",level:2}],u={toc:m},f="wrapper";function y(e){var n=e.components,t=(0,a.Z)(e,s);return(0,o.kt)(f,(0,r.Z)({},u,t,{components:n,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"getting-started"},"Getting Started"),(0,o.kt)("h2",{id:"install-12kb-gzipped-0-dependencies"},"Install ",(0,o.kt)("sub",null,(0,o.kt)("sub",null,"\ud83d\udce6",(0,o.kt)("inlineCode",{parentName:"h2"},"12KB")," gzipped, ",(0,o.kt)("inlineCode",{parentName:"h2"},"0")," dependencies"))),(0,o.kt)("img",{src:"/img/npm.svg",alt:"Npm Icon",height:"16px"})," ",(0,o.kt)("code",null,"npm install arktype"),(0,o.kt)("sub",null,"(or whatever package manager you prefer)"),(0,o.kt)("br",null),(0,o.kt)("p",null,"Our types are tested in ",(0,o.kt)("a",{parentName:"p",href:"https://www.typescriptlang.org/tsconfig#strict"},"strict-mode")," with TypeScript versions ",(0,o.kt)("inlineCode",{parentName:"p"},"4.8"),", ",(0,o.kt)("inlineCode",{parentName:"p"},"4.9"),", and ",(0,o.kt)("inlineCode",{parentName:"p"},"5.0"),"."),(0,o.kt)("p",null,(0,o.kt)("em",{parentName:"p"},"Our APIs have mostly stabilized, but details may still change during the alpha/beta stages of our 1.0 release. If you have suggestions that may require a breaking change, now is the time to let us know!")," \u26f5"),(0,o.kt)("h2",{id:"your-first-type"},"Your first type"),(0,o.kt)(i.g,{embedId:"type",mdxType:"StackBlitzDemo"}))}y.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/dda49074.4a181198.js b/assets/js/dda49074.4a181198.js deleted file mode 100644 index ab8924ca2f..0000000000 --- a/assets/js/dda49074.4a181198.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkarktype_io=self.webpackChunkarktype_io||[]).push([[3678,3237],{76570:(e,t,n)=>{n.d(t,{g:()=>h});var r=n(56632),a=n(82786),i=n(53800),o=n(49361),l=n(29901),c=n(43346);var s=function(e){var t=m[e];return'import {populateDemo} from "./populateDemo"\n(async () => {\n try {\n '+t[0]+"\n populateDemo("+t[1]+')\n } catch(e) {\n populateDemo({ \n type: {\n definition: ""\n },\n data: "",\n problems: "ParseError: " + e.originalErr.message\n } as any)\n }\n})()'},m={type:['const { user, data, problems } = await import("./type")',"{ type: user, data, problems }"],scope:['const { types, data, problems } = await import("./scope")',"{ type: types.package, data, problems }"],demo:['const { pkg, data, problems } = await import("./demo")',"{ type: pkg, data, problems }"]};var p={"index.html":'\n \n\n
\n
\n
\n

Definition

\n
\n
\n
\n
\n
\n

Output

\n
\n
\n
\n
\n',"demo.css":'body {\n font-family: "Cascadia Code", sans-serif;\n background-color: hsl(220 18% 10%);\n}\n\n#demo {\n display: flex;\n flex-direction: column;\n gap: 1rem;\n margin: -0.5rem;\n padding: 0.5rem;\n}\n\n#input {\n display: flex;\n flex-direction: row;\n flex-wrap: wrap;\n gap: 0.5rem;\n}\n\n.section {\n display: flex;\n flex-direction: column;\n flex-grow: 1;\n gap: 0.5rem;\n}\n\np {\n white-space: pre-wrap;\n}\n\npre {\n white-space: pre-wrap;\n}\n\nh3 {\n margin: 0px;\n color: #fffff0;\n}\n\n.key {\n color: #80cff8;\n}\n.val {\n color: #f5cf8f;\n}\n.operator {\n color: #eb9f2e;\n}\n.bracket {\n color: #009eff;\n}\n.card {\n padding: 1rem;\n background-color: rgb(18, 18, 18);\n color: rgb(255, 255, 255);\n /* transition: box-shadow 300ms cubic-bezier(0.4, 0, 0.2, 1) 0ms; */\n border-radius: 1rem;\n box-shadow: rgba(0, 0, 0, 0.2) 0px 2px 1px -1px,\n rgba(0, 0, 0, 0.14) 0px 1px 1px 0px, rgba(0, 0, 0, 0.12) 0px 1px 3px 0px;\n background-image: linear-gradient(\n rgba(255, 255, 255, 0.05),\n rgba(255, 255, 255, 0.05)\n );\n height: 100%;\n}\n',"populateDemo.ts":'import "./demo.css"\nimport type { Problems, Type } from "arktype"\nimport { stringify } from "arktype/internal/utils/serialize.js"\n\ntype PopulateDemoArgs = {\n type: Type\n data: unknown\n problems: Problems\n}\nexport const populateDemo = ({ data, type, problems }: PopulateDemoArgs) => {\n const defElement = document.querySelector("#definition")!\n defElement.textContent = stringify(type.definition, 2)\n defElement.innerHTML = recolor(defElement.innerHTML)\n\n const resultElement = document.querySelector("#output")!\n if (problems) {\n resultElement.textContent = `\u274c problems:\n\n${problems}`\n } else {\n resultElement.textContent = `\u2705 data:\n\n${stringify(data, 2)}`\n resultElement.innerHTML = recolor(resultElement.innerHTML)\n }\n}\n\nconst recolor = (input: string) => {\n const lines = input.split("\\n")\n const fixedInput: string[] = [""]\n for (const line of lines) {\n if (line.includes(":")) {\n const parts = line.split(":")\n fixedInput.push(`${buildKey(parts[0])}: ${buildVal(parts[1])}`)\n } else {\n fixedInput.push(addArkdarkStyles(line))\n }\n }\n fixedInput.push("")\n return fixedInput.join("\\n")\n}\n\nconst buildKey = (key: string) => {\n return `${key}`\n}\nconst buildVal = (val: string) => {\n const formatted = addArkdarkStyles(val.trim())\n if (formatted[formatted.length - 1] === ",") {\n return `${formatted.replace(",", "")},`\n } else if (formatted[formatted.length - 1] === "{") {\n return "{"\n }\n return `${formatted}`\n}\nconst addArkdarkStyles = (line: string) => {\n const brackets = ["[", "]", "(", ")"]\n const operators = [">", "<", ">e;", "<e;", "|"]\n let modifiedLine = line\n for (const bracket of brackets) {\n modifiedLine = modifiedLine.replaceAll(\n bracket,\n `${bracket}`\n )\n }\n for (const operator of operators) {\n modifiedLine = modifiedLine.replaceAll(\n operator,\n `${operator}`\n )\n }\n return modifiedLine\n}\n',"tsconfig.json":JSON.stringify({compilerOptions:{module:"esnext",target:"esnext",strict:!0}},null,4)},d={type:'import { type } from "arktype"\n\n// Definitions are statically parsed and inferred as TS.\nexport const user = type({\n name: "string",\n device: {\n platform: "\'android\'|\'ios\'",\n "version?": "number"\n }\n})\n\n// Validators return typed data or clear, customizable errors.\nexport const { data, problems } = user({\n name: "Alan Turing",\n device: {\n // problems.summary: "device/platform must be \'android\' or \'ios\' (was \'enigma\')"\n platform: "enigma"\n }\n})\n',scope:'import { scope } from "arktype"\n\n// Scopes are collections of types that can reference each other.\nexport const types = scope({\n package: {\n name: "string",\n "dependencies?": "package[]",\n "contributors?": "contributor[]"\n },\n contributor: {\n // Subtypes like \'email\' are inferred like \'string\' but provide additional validation at runtime.\n email: "email",\n "packages?": "package[]"\n }\n}).compile()\n\n// Cyclic types are inferred to arbitrary depth...\nexport type Package = typeof types.package.infer\n\n// And can validate cyclic data.\nconst packageData: Package = {\n name: "arktype",\n dependencies: [{ name: "typescript" }],\n contributors: [{ email: "david@sharktypeio" }]\n}\npackageData.dependencies![0].dependencies = [packageData]\n\nexport const { data, problems } = types.package(packageData)\n',demo:'import { type } from "arktype"\n\n// Define your type...\nexport const pkg = type({\n name: "string",\n version: "semver",\n "contributors?": "1{n.r(t),n.d(t,{default:()=>se});var r,a,i,o,l,c,s,m,p,d,u,f=n(43597),h=n(78099),g=n(2372),y=n(29901),b=n(63221),v=n(53800),E=n(85569),k=n(54805),x=n(55850),w=n(68584),Z=n(70856),z=function(e){return y.createElement("video",(0,k.Z)({autoPlay:!0,loop:!0,controls:!0,playsInline:!0,muted:!0,disablePictureInPicture:!0},e))},T=n(14043),C=function(){return(0,T.Z)("(max-width:1250px)")},I=y.createElement("div",{className:"inferable-code"},y.createElement(Z.Z,{language:"typescript"},'const user = type({\n name: "string",\n device: {\n platform: "\'android\'|\'ios\'",\n "version?": "number"\n }\n})\n\n\n// Hover to infer...\ntype User = typeof user.infer\n'),y.createElement("img",{height:"50%",src:"/img/isomorphicHover.png"})),S=y.createElement("div",{className:"inferable-code"},y.createElement(Z.Z,{language:"typescript"},"// Hover to infer...\n",'const arkUser = type({\n name: /^ark.*$/ as Infer<`ark${string}`>,\n birthday: morph("string", (s) => new Date(s)),\n "powerLevel?": "1<=number<9000"\n})'),y.createElement("img",{height:"60%",src:"/img/arkUser.png"})),H=y.createElement("div",{className:"inferable-code"},y.createElement(Z.Z,{language:"typescript"},"// Hover to infer...\n",'const zodUser = z.object({\n name: z.custom<`zod${string}`>(\n (val) => typeof val === "string" && /^zod.*$/.test(val)\n ),\n birthday: z.preprocess(\n (arg) => (typeof arg === "string" ? new Date(arg) : undefined),\n z.date()\n ),\n powerLevel: z.number().gte(1).lt(9000).optional()\n})'),y.createElement("img",{height:"80%",src:"/img/zodInfer.png"})),O=y.createElement(y.Fragment,null,S,H),j=y.createElement("div",{className:"inferable-code"},y.createElement(Z.Z,{language:"typescript"},"// Hover to see internal representation...\n","export const deepLeftOrRight = union(\n {\n auto: {\n discriminated: \"'left'\"\n }\n },\n {\n auto: {\n discriminated: \"'right'\"\n }\n }\n)"),y.createElement("img",{src:"/img/optimizedUnion.png"})),D=y.createElement("div",{className:"inferable-code"},y.createElement(Z.Z,{language:"typescript"},"// Hover to see internal representation...\n",'export const numericIntersection = type(\n "(1 <= number%2 < 100) & (0 < number%3 <= 99)"\n)',"\n \n\n\n\n\n"),y.createElement("img",{src:"/img/optimizedNumber.png"})),M=[{title:"Isomorphic",description:"Define types using TS syntax. Infer them 1:1. Use them to validate your data at runtime.",image:I},{title:"Concise",description:"Say more with less",image:O},{title:"Optimized",description:"ArkType is not just a validator\u2014 it's a full type system. Operations are deeply computed and optimized by default",image:y.createElement(y.Fragment,null,j,D)},{title:"Type-safe",description:"String definitions are statically parsed with each character you type and give detailed feedback just like in your editor.",image:y.createElement(v.Z,{width:"100%"},y.createElement(z,{src:"/img/typePerf.mp4"}),y.createElement("caption",{style:{fontSize:".8rem"}},"Worried about performance? Don't be. This is how it feels to interact with a scope of 100 cyclic types (you may want to go fullscreen to see the details!)"))}],P=function(){return y.createElement(x.ZP,{sx:{alignContent:"center"},columns:C()?1:2,spacing:3},M.map((function(e,t){return y.createElement(L,(0,k.Z)({key:t},e))})))},L=function(e){var t,n=(0,w.Z)();return y.createElement(v.Z,{spacing:2,maxWidth:"40em"},y.createElement(E.Z,{component:"h3",variant:"h5",fontWeight:"700",width:"100%",textAlign:"center",color:n.palette.info.main},e.title),y.createElement(E.Z,{component:"p",variant:"body1",fontWeight:"300",minHeight:"3rem"},e.description),y.createElement("div",{style:{padding:"6px",borderRadius:"16px"}},null!=(t=e.image)?t:null))},N=n(96172),$=n(36832),A=n(50931),F=n(73760),W=n(35601),U=n(76570),q=n(17188),R=n(39069),V=function(){var e=(0,N.TH)().pathname,t=(0,w.Z)().palette,n="dark"===(0,b.I)().colorMode,r=(0,y.useState)(e.includes("try")),a=r[0],i=r[1],o=n?"#ffffff00":"#000000aa";return y.createElement(y.Fragment,null,y.createElement(v.Z,{alignItems:"start",width:"100%"},y.createElement(F.Z,{variant:"contained",sx:{backgroundColor:o,backdropFilter:"blur(4px)",borderRadius:"2rem",fontSize:"1.5rem",fontFamily:'"Cascadia Code", sans-serif',textTransform:"none",color:t.primary.main,"&:hover":{backgroundColor:o,color:t.secondary.main,backdropFilter:"blur(6px)"},zIndex:1},onClick:function(){return i(!a)},endIcon:y.createElement("div",{style:{display:"flex"}},a?y.createElement($.Z,null):y.createElement(A.Z,null))},a?"$ wq!":"$ code demo.ts",y.createElement(W.E.div,{animate:{opacity:0},transition:{duration:.5,repeatType:"mirror",repeat:1/0}},"_"))),y.createElement(v.Z,{width:"100%"},a?y.createElement(U.g,{embedId:"demo"}):y.createElement(z,{src:"/img/arktype.mp4",style:{width:"100%",marginTop:"-2.8rem"}})),y.createElement("sub",{style:{marginLeft:"2.3px",marginTop:"5px"}},y.createElement("code",null,"typescript@4.9.5")," in VS Code\u2014 no extensions or plugins required (",y.createElement("a",{href:"https://github.com/arktypeio/arktype#how",target:"_blank"},"how?"),")"))},_=n(47699),J=n(54852),G=n(17739),K=n(57487),B=n(84123),Y=function(){var e=(0,K.v)().scrollY,t=(0,B._)(),n={position:"absolute",top:60,width:386};return e.onChange((function(e){t.start(e?{position:"fixed",top:"50%",width:340}:n)})),y.createElement(W.E.div,{style:{right:0},initial:n,animate:t},y.createElement(X,null))},Q=function(){return y.createElement("div",{style:{width:"100%"}},y.createElement(X,null))},X=function(){return y.createElement(_.Z,{style:{height:"8rem",margin:".5rem",padding:".7rem 1rem 0rem",backgroundColor:"#ffffff00",backdropFilter:"blur(1px)",borderRadius:"2rem",zIndex:1,fontFamily:'"Cascadia Code", sans-serif'},elevation:8},y.createElement(G.Z,{className:"installationTabs"},y.createElement(J.Z,{value:"node",default:!0},y.createElement(G.Z,{className:"subTabs"},y.createElement(J.Z,{value:"npm",attributes:{className:"npmTab"}},y.createElement(Z.Z,{language:"bash"},"npm install arktype")),y.createElement(J.Z,{value:"pnpm",attributes:{className:"pnpmTab"}},y.createElement(Z.Z,{language:"bash"},"pnpm add arktype")),y.createElement(J.Z,{value:"yarn",attributes:{className:"yarnTab"}},y.createElement(Z.Z,{language:"bash"},"yarn add arktype")))),y.createElement(J.Z,{value:"bun",label:"bun"},y.createElement(Z.Z,{language:"bash"},"bun install arktype")),y.createElement(J.Z,{value:"deno",label:"deno"},y.createElement(Z.Z,{language:"typescript"},'import { type } from "npm:arktype"'))))},ee=function(){var e=(0,b.I)().colorMode;return y.createElement("main",{style:{display:"flex",justifyContent:"center"}},y.createElement(v.Z,{justifyContent:"center",padding:"1rem 0rem 1rem",spacing:1,width:"100%",maxWidth:"60rem"},y.createElement(V,null),(0,T.Z)("(min-width:1420px)")?y.createElement(Y,null):y.createElement(Q,null),y.createElement(E.Z,{color:"dark"===e?"primary.light":"primary.dark",className:"contents",fontSize:"1.3rem"},y.createElement("p",null,"ArkType is a runtime validation library that can infer"," ",y.createElement("b",null,"TypeScript definitions 1:1")," and reuse them as"," ",y.createElement("b",null,"highly-optimized validators")," for your data."),y.createElement("p",null,"With each character you type, you'll get"," ",y.createElement("b",null,"immediate feedback from your editor")," in the form of either a fully-inferred ",y.createElement("code",null,"Type")," or a specific and helpful ",y.createElement("code",null,"ParseError"),"."),y.createElement("p",null,"This result exactly mirrors what you can expect to happen at runtime down to the punctuation of the error message- ",y.createElement("b",null,"no plugins required"),".")),y.createElement(P,null)))},te=["title","titleId"];function ne(){return ne=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}const ae=function(e){var t=e.title,n=e.titleId,f=re(e,te);return y.createElement("svg",ne({viewBox:"0 0 375 375","aria-labelledby":n},f),t?y.createElement("title",{id:n},t):null,r||(r=y.createElement("path",{fill:"#4b3621",d:"M5.314 281.357h27.799l9.62-38.835a5.288 5.337 0 0 1 5.156-4.077h212.609a5.288 5.337 0 0 1 5.156 4.077l9.461 38.3 37.844-4.775c1.754-.268 3.508.43 4.678 1.824 1.169 1.34 1.542 3.218 1.063 4.935l-10.63 37.548a5.295 5.344 0 0 1-5.103 3.916H5.315c-2.923 0-5.316-2.414-5.316-5.364V286.72c0-2.95 2.391-5.364 5.315-5.364Zm127.566-32.184H52.035l-7.972 32.184h88.817zm31.89 0h-21.26v32.184h21.26zm91.582 0h-80.95v32.184h88.923zM10.63 313.542h288.35l7.283-25.855-34.55 4.344c-.212.054-.425.054-.637.054H10.629v21.457z"})),a||(a=y.createElement("path",{fill:"none",d:"M106.994 267.84a5.281 5.33 0 0 0 4.624 2.789c.904 0 1.754-.215 2.604-.697a5.358 5.358 0 0 0 2.073-7.296c-1.435-2.574-4.624-3.54-7.229-2.092-2.55 1.449-3.507 4.72-2.072 7.296zm-43.212-2.575c0 2.95 2.338 5.364 5.262 5.364h.052c2.924 0 5.316-2.414 5.316-5.364 0-2.95-2.392-5.364-5.316-5.364-2.923 0-5.314 2.413-5.314 5.364zm127.671.805c.425 2.628 2.658 4.56 5.262 4.56.266 0 .531 0 .797-.054 2.87-.43 4.943-3.165 4.465-6.115-.426-2.95-3.083-4.989-6.006-4.506h-.053c-2.87.428-4.89 3.165-4.465 6.114zm21.155-.805c0 2.95 2.391 5.364 5.315 5.364 2.924 0 5.369-2.414 5.369-5.364 0-2.95-2.392-5.364-5.316-5.364h-.053c-2.923 0-5.315 2.413-5.315 5.364zm-127.566 0c0 2.95 2.339 5.364 5.262 5.364h.053c2.923 0 5.316-2.414 5.316-5.364 0-2.95-2.392-5.364-5.316-5.364s-5.315 2.413-5.315 5.364zm152.866 5.203a5.232 5.28 0 0 0 1.276.161 5.284 5.284 0 0 0 5.156-4.077c.744-2.843-.957-5.793-3.827-6.49h-.053c-2.87-.698-5.74 1.018-6.432 3.916a5.39 5.39 0 0 0 3.88 6.49z"})),i||(i=y.createElement("path",{fill:"none",d:"M182.736 249.173h73.616l6.644 26.82h-80.26Zm55.172 21.295a5.232 5.28 0 0 0 1.276.161 5.284 5.284 0 0 0 5.156-4.077c.744-2.843-.957-5.793-3.827-6.49h-.053c-2.87-.698-5.74 1.018-6.432 3.916a5.39 5.39 0 0 0 3.88 6.49zm-19.985.161c2.923 0 5.369-2.414 5.369-5.364 0-2.95-2.392-5.364-5.316-5.364h-.053c-2.923 0-5.315 2.413-5.315 5.364 0 2.95 2.392 5.364 5.315 5.364zm-21.208 0c.266 0 .532 0 .798-.053 2.87-.43 4.943-3.165 4.464-6.115-.425-2.95-3.082-4.989-6.006-4.506h-.053c-2.87.43-4.89 3.165-4.464 6.115.424 2.627 2.657 4.56 5.262 4.56z"})),o||(o=y.createElement("path",{fill:"none",d:"M182.736 249.173v26.82h80.26l1.329 5.364H175.4v-32.184zm-17.966 0h-13.925v26.82h13.925z"})),l||(l=y.createElement("path",{fill:"none",d:"M150.845 249.173v26.82h13.925v5.364h-21.26v-32.184zm-92.805 0h74.84v26.82H51.397Zm48.954 18.667a5.281 5.33 0 0 0 4.624 2.789c.904 0 1.754-.215 2.604-.697a5.358 5.358 0 0 0 2.073-7.296c-1.435-2.574-4.624-3.54-7.229-2.092-2.55 1.449-3.507 4.72-2.072 7.296zm-16.69 2.79h.053c2.923 0 5.316-2.415 5.316-5.365s-2.392-5.364-5.316-5.364-5.315 2.413-5.315 5.364c0 2.95 2.34 5.364 5.262 5.364zm-21.26 0h.052c2.924 0 5.316-2.415 5.316-5.365s-2.392-5.364-5.316-5.364c-2.923 0-5.315 2.413-5.315 5.364 0 2.95 2.34 5.364 5.262 5.364z"})),c||(c=y.createElement("path",{fill:"none",d:"M52.035 249.173h6.006l-6.644 26.82h81.483v5.364H44.062Zm-34.071 42.912h253.111c.213 0 .426 0 .638-.053l34.55-4.345-5.773 20.49H17.964Z"})),s||(s=y.createElement("path",{fill:"none",d:"m300.49 308.178-1.51 5.364zM17.964 292.085v16.093H300.49l-1.51 5.364H10.63v-21.457z"})),m||(m=y.createElement("path",{fill:"none",d:"M10.934 302.813v-10.728l131.358.01 131.358.01 15.636-1.955c8.6-1.076 15.786-1.805 15.968-1.621.182.184-1.236 5.887-3.152 12.674l-3.485 12.34H10.934Z"})),p||(p=y.createElement("path",{fill:"#eb9f2e",d:"M11.237 302.813v-10.728l132.573-.01 132.573-.01 12.453-1.519c14.274-1.741 15.793-1.814 15.794-.759 0 .422-1.407 5.939-3.128 12.26l-3.13 11.495H11.238Z"})),d||(d=y.createElement("path",{fill:"none",d:"M44.664 280.591c.009-.253 1.734-7.356 3.834-15.785l3.817-15.326 40.205-.157 40.205-.158v31.886h-44.04c-24.221 0-44.031-.207-44.021-.46zm28.34-11.294c1.408-1.335 1.898-4.63 1.03-6.916-.493-1.295-3.389-2.786-5.41-2.786-2.105 0-5.147 3.07-5.147 5.194 0 1.889 1.463 4.981 2.569 5.43 2.048.832 5.606.36 6.959-.922zm21.261 0c1.407-1.335 1.898-4.63 1.029-6.916-.493-1.295-3.389-2.786-5.41-2.786-2.105 0-5.147 3.07-5.147 5.194 0 1.889 1.463 4.981 2.569 5.43 2.049.832 5.606.36 6.959-.922zm20.992.12c1.898-1.506 2.42-4.01 1.367-6.554-.942-2.274-2.512-3.268-5.167-3.268-2.42 0-5.46 2.891-5.46 5.194 0 1.889 1.463 4.981 2.57 5.43 1.852.752 5.245.346 6.69-.802zm28.401-4.305v-15.938h20.653v31.876h-20.653z"})),u||(u=y.createElement("path",{fill:"#eb9f2e",d:"M175.852 265.112v-15.938h80.135l.6 2.299c.33 1.264 1.993 7.953 3.694 14.865 1.702 6.912 3.237 13.05 3.413 13.64.301 1.015-2.064 1.073-43.761 1.073h-44.08Zm24.73 4.138c1.832-2.02 2.163-3.777 1.165-6.189-1.626-3.926-5.907-4.728-8.933-1.674-1.989 2.007-2.257 4.073-.877 6.765 1.064 2.077 1.647 2.365 4.918 2.429 1.832.036 2.801-.31 3.727-1.33zm21.246 0c1.735-1.934 2.089-3.992 1.098-6.384-1.495-3.61-5.994-4.363-8.852-1.479-1.988 2.007-2.256 4.073-.877 6.765 1.064 2.077 1.647 2.365 4.918 2.429 1.836.036 2.796-.308 3.713-1.33zm21.259.047c1.038-.985 1.406-2.009 1.406-3.917 0-3.434-1.442-5.155-4.685-5.594-2.255-.305-2.757-.131-4.397 1.524-2.067 2.086-2.35 4.117-.954 6.842 1.06 2.067 1.651 2.365 4.833 2.429 1.666.034 2.817-.356 3.797-1.284zm-99.429-4.185v-15.938h20.653v31.876h-20.653zm-78.814 15.479c-10.775-.094-19.59-.408-19.59-.699 0-.797 7.103-29.51 7.366-29.774.125-.127 18.2-.322 40.166-.434l39.939-.204v31.571l-24.146-.145c-13.28-.079-32.961-.22-43.735-.315Zm7.764-10.585c1.609-.87 2.585-4.818 1.772-7.171-1.21-3.501-6.312-4.384-9.2-1.593-1.966 1.902-2.253 4.697-.776 7.579.84 1.64 1.212 1.808 3.988 1.808 1.684 0 3.58-.28 4.216-.623zm21.26 0c1.61-.87 2.585-4.818 1.772-7.171-1.21-3.501-6.312-4.384-9.2-1.593-1.966 1.902-2.253 4.697-.776 7.579.84 1.64 1.212 1.808 3.988 1.808 1.684 0 3.581-.28 4.216-.623zm21.833-.587c1.661-1.676 2.08-3.852 1.24-6.424-.847-2.588-2.125-3.4-5.354-3.4-4.654 0-7.006 4.654-4.663 9.226.855 1.668 1.184 1.808 4.252 1.808 2.501 0 3.623-.3 4.525-1.21z"})))};var ie=function(){for(var e,t,n,r=(e=(0,y.useState)({width:globalThis.innerWidth,height:globalThis.innerHeight}),t=e[0],n=e[1],(0,y.useEffect)((function(){var e=function(){n({width:window.innerWidth,height:window.innerHeight})};return window.addEventListener("resize",e),function(){window.removeEventListener("resize",e)}}),[]),t).width/16,a=[],i=0;i{n.r(t),n.d(t,{default:()=>i});var r=n(29901),a=n(99269);const i=function(){return r.createElement(a.default,null)}}}]); \ No newline at end of file diff --git a/assets/js/dda49074.c7c435a7.js b/assets/js/dda49074.c7c435a7.js new file mode 100644 index 0000000000..f26ed7e728 --- /dev/null +++ b/assets/js/dda49074.c7c435a7.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkarktype_io=self.webpackChunkarktype_io||[]).push([[3678,3237],{76570:(e,t,n)=>{n.d(t,{g:()=>h});var r=n(56632),a=n(82786),i=n(53800),o=n(49361),l=n(29901),c=n(43346);var s=function(e){var t=m[e];return'import {populateDemo} from "./populateDemo"\n(async () => {\n try {\n '+t[0]+"\n populateDemo("+t[1]+')\n } catch(e) {\n populateDemo({ \n type: {\n definition: ""\n },\n data: "",\n problems: "ParseError: " + e.originalErr.message\n } as any)\n }\n})()'},m={type:['const { user, data, problems } = await import("./type")',"{ type: user, data, problems }"],scope:['const { types, data, problems } = await import("./scope")',"{ type: types.package, data, problems }"],demo:['const { pkg, data, problems } = await import("./demo")',"{ type: pkg, data, problems }"]};var p={"index.html":'\n \n\n
\n
\n
\n

Definition

\n
\n
\n
\n
\n
\n

Output

\n
\n
\n
\n
\n',"demo.css":'body {\n font-family: "Cascadia Code", sans-serif;\n background-color: hsl(220 18% 10%);\n}\n\n#demo {\n display: flex;\n flex-direction: column;\n gap: 1rem;\n margin: -0.5rem;\n padding: 0.5rem;\n}\n\n#input {\n display: flex;\n flex-direction: row;\n flex-wrap: wrap;\n gap: 0.5rem;\n}\n\n.section {\n display: flex;\n flex-direction: column;\n flex-grow: 1;\n gap: 0.5rem;\n}\n\np {\n white-space: pre-wrap;\n}\n\npre {\n white-space: pre-wrap;\n}\n\nh3 {\n margin: 0px;\n color: #fffff0;\n}\n\n.key {\n color: #80cff8;\n}\n.val {\n color: #f5cf8f;\n}\n.operator {\n color: #eb9f2e;\n}\n.bracket {\n color: #009eff;\n}\n.card {\n padding: 1rem;\n background-color: rgb(18, 18, 18);\n color: rgb(255, 255, 255);\n /* transition: box-shadow 300ms cubic-bezier(0.4, 0, 0.2, 1) 0ms; */\n border-radius: 1rem;\n box-shadow: rgba(0, 0, 0, 0.2) 0px 2px 1px -1px,\n rgba(0, 0, 0, 0.14) 0px 1px 1px 0px, rgba(0, 0, 0, 0.12) 0px 1px 3px 0px;\n background-image: linear-gradient(\n rgba(255, 255, 255, 0.05),\n rgba(255, 255, 255, 0.05)\n );\n height: 100%;\n}\n',"populateDemo.ts":'import "./demo.css"\nimport type { Problems, Type } from "arktype"\nimport { stringify } from "arktype/internal/utils/serialize.js"\n\ntype PopulateDemoArgs = {\n type: Type\n data: unknown\n problems: Problems\n}\nexport const populateDemo = ({ data, type, problems }: PopulateDemoArgs) => {\n const defElement = document.querySelector("#definition")!\n defElement.textContent = stringify(type.definition, 2)\n defElement.innerHTML = recolor(defElement.innerHTML)\n\n const resultElement = document.querySelector("#output")!\n if (problems) {\n resultElement.textContent = `\u274c problems:\n\n${problems}`\n } else {\n resultElement.textContent = `\u2705 data:\n\n${stringify(data, 2)}`\n resultElement.innerHTML = recolor(resultElement.innerHTML)\n }\n}\n\nconst recolor = (input: string) => {\n const lines = input.split("\\n")\n const fixedInput: string[] = [""]\n for (const line of lines) {\n if (line.includes(":")) {\n const parts = line.split(":")\n fixedInput.push(`${buildKey(parts[0])}: ${buildVal(parts[1])}`)\n } else {\n fixedInput.push(addArkdarkStyles(line))\n }\n }\n fixedInput.push("")\n return fixedInput.join("\\n")\n}\n\nconst buildKey = (key: string) => {\n return `${key}`\n}\nconst buildVal = (val: string) => {\n const formatted = addArkdarkStyles(val.trim())\n if (formatted[formatted.length - 1] === ",") {\n return `${formatted.replace(",", "")},`\n } else if (formatted[formatted.length - 1] === "{") {\n return "{"\n }\n return `${formatted}`\n}\nconst addArkdarkStyles = (line: string) => {\n const brackets = ["[", "]", "(", ")"]\n const operators = [">", "<", ">e;", "<e;", "|"]\n let modifiedLine = line\n for (const bracket of brackets) {\n modifiedLine = modifiedLine.replaceAll(\n bracket,\n `${bracket}`\n )\n }\n for (const operator of operators) {\n modifiedLine = modifiedLine.replaceAll(\n operator,\n `${operator}`\n )\n }\n return modifiedLine\n}\n',"tsconfig.json":JSON.stringify({compilerOptions:{module:"esnext",target:"esnext",strict:!0}},null,4)},d={type:'import { type } from "arktype"\n\n// Definitions are statically parsed and inferred as TS.\nexport const user = type({\n name: "string",\n device: {\n platform: "\'android\'|\'ios\'",\n "version?": "number"\n }\n})\n\n// Validators return typed data or clear, customizable errors.\nexport const { data, problems } = user({\n name: "Alan Turing",\n device: {\n // problems.summary: "device/platform must be \'android\' or \'ios\' (was \'enigma\')"\n platform: "enigma"\n }\n})\n',scope:'import { scope } from "arktype"\n\n// Scopes are collections of types that can reference each other.\nexport const types = scope({\n package: {\n name: "string",\n "dependencies?": "package[]",\n "contributors?": "contributor[]"\n },\n contributor: {\n // Subtypes like \'email\' are inferred like \'string\' but provide additional validation at runtime.\n email: "email",\n "packages?": "package[]"\n }\n}).compile()\n\n// Cyclic types are inferred to arbitrary depth...\nexport type Package = typeof types.package.infer\n\n// And can validate cyclic data.\nconst packageData: Package = {\n name: "arktype",\n dependencies: [{ name: "typescript" }],\n contributors: [{ email: "david@sharktypeio" }]\n}\npackageData.dependencies![0].dependencies = [packageData]\n\nexport const { data, problems } = types.package(packageData)\n',demo:'import { type } from "arktype"\n\n// Define your type...\nexport const pkg = type({\n name: "string",\n version: "semver",\n "contributors?": "1{n.r(t),n.d(t,{default:()=>se});var r,a,i,o,l,c,s,m,p,d,u,f=n(43597),h=n(78099),g=n(2372),y=n(29901),b=n(63221),v=n(53800),E=n(85569),k=n(54805),x=n(55850),w=n(68584),Z=n(70856),z=function(e){return y.createElement("video",(0,k.Z)({autoPlay:!0,loop:!0,controls:!0,playsInline:!0,muted:!0,disablePictureInPicture:!0},e))},T=n(14043),C=function(){return(0,T.Z)("(max-width:1250px)")},I=y.createElement("div",{className:"inferable-code"},y.createElement(Z.Z,{language:"typescript"},'const user = type({\n name: "string",\n device: {\n platform: "\'android\'|\'ios\'",\n "version?": "number"\n }\n})\n\n\n// Hover to infer...\ntype User = typeof user.infer\n'),y.createElement("img",{height:"50%",src:"/img/isomorphicHover.png"})),S=y.createElement("div",{className:"inferable-code"},y.createElement(Z.Z,{language:"typescript"},"// Hover to infer...\n",'const arkUser = type({\n name: /^ark.*$/ as Infer<`ark${string}`>,\n birthday: morph("string", (s) => new Date(s)),\n "powerLevel?": "1<=number<9000"\n})'),y.createElement("img",{height:"60%",src:"/img/arkUser.png"})),H=y.createElement("div",{className:"inferable-code"},y.createElement(Z.Z,{language:"typescript"},"// Hover to infer...\n",'const zodUser = z.object({\n name: z.custom<`zod${string}`>(\n (val) => typeof val === "string" && /^zod.*$/.test(val)\n ),\n birthday: z.preprocess(\n (arg) => (typeof arg === "string" ? new Date(arg) : undefined),\n z.date()\n ),\n powerLevel: z.number().gte(1).lt(9000).optional()\n})'),y.createElement("img",{height:"80%",src:"/img/zodInfer.png"})),O=y.createElement(y.Fragment,null,S,H),j=y.createElement("div",{className:"inferable-code"},y.createElement(Z.Z,{language:"typescript"},"// Hover to see internal representation...\n","export const deepLeftOrRight = union(\n {\n auto: {\n discriminated: \"'left'\"\n }\n },\n {\n auto: {\n discriminated: \"'right'\"\n }\n }\n)"),y.createElement("img",{src:"/img/optimizedUnion.png"})),D=y.createElement("div",{className:"inferable-code"},y.createElement(Z.Z,{language:"typescript"},"// Hover to see internal representation...\n",'export const numericIntersection = type(\n "(1 <= number%2 < 100) & (0 < number%3 <= 99)"\n)',"\n \n\n\n\n\n"),y.createElement("img",{src:"/img/optimizedNumber.png"})),M=[{title:"Isomorphic",description:"Define types using TS syntax. Infer them 1:1. Use them to validate your data at runtime.",image:I},{title:"Concise",description:"Say more with less",image:O},{title:"Optimized",description:"ArkType is not just a validator\u2014 it's a full type system. Operations are deeply computed and optimized by default",image:y.createElement(y.Fragment,null,j,D)},{title:"Type-safe",description:"String definitions are statically parsed with each character you type and give detailed feedback just like in your editor.",image:y.createElement(v.Z,{width:"100%"},y.createElement(z,{src:"/img/typePerf.mp4"}),y.createElement("caption",{style:{fontSize:".8rem"}},"Worried about performance? Don't be. This is how it feels to interact with a scope of 100 cyclic types (you may want to go fullscreen to see the details!)"))}],P=function(){return y.createElement(x.ZP,{sx:{alignContent:"center"},columns:C()?1:2,spacing:3},M.map((function(e,t){return y.createElement(L,(0,k.Z)({key:t},e))})))},L=function(e){var t,n=(0,w.Z)();return y.createElement(v.Z,{spacing:2,maxWidth:"40em"},y.createElement(E.Z,{component:"h3",variant:"h5",fontWeight:"700",width:"100%",textAlign:"center",color:n.palette.info.main},e.title),y.createElement(E.Z,{component:"p",variant:"body1",fontWeight:"300",minHeight:"3rem"},e.description),y.createElement("div",{style:{padding:"6px",borderRadius:"16px"}},null!=(t=e.image)?t:null))},N=n(96172),$=n(36832),A=n(50931),F=n(73760),W=n(35601),U=n(76570),q=n(17188),R=n(39069),V=function(){var e=(0,N.TH)().pathname,t=(0,w.Z)().palette,n="dark"===(0,b.I)().colorMode,r=(0,y.useState)(e.includes("try")),a=r[0],i=r[1],o=n?"#ffffff00":"#000000aa";return y.createElement(y.Fragment,null,y.createElement(v.Z,{alignItems:"start",width:"100%"},y.createElement(F.Z,{variant:"contained",sx:{backgroundColor:o,backdropFilter:"blur(4px)",borderRadius:"2rem",fontSize:"1.5rem",fontFamily:'"Cascadia Code", sans-serif',textTransform:"none",color:t.primary.main,"&:hover":{backgroundColor:o,color:t.secondary.main,backdropFilter:"blur(6px)"},zIndex:1},onClick:function(){return i(!a)},endIcon:y.createElement("div",{style:{display:"flex"}},a?y.createElement($.Z,null):y.createElement(A.Z,null))},a?"$ wq!":"$ code demo.ts",y.createElement(W.E.div,{animate:{opacity:0},transition:{duration:.5,repeatType:"mirror",repeat:1/0}},"_"))),y.createElement(v.Z,{width:"100%"},a?y.createElement(U.g,{embedId:"demo"}):y.createElement(z,{src:"/img/arktype.mp4",style:{width:"100%",marginTop:"-2.8rem"}})),y.createElement("sub",{style:{marginLeft:"2.3px",marginTop:"5px"}},y.createElement("code",null,"typescript@4.9.5")," in VS Code\u2014 no extensions or plugins required (",y.createElement("a",{href:"https://github.com/arktypeio/arktype#how",target:"_blank"},"how?"),")"))},_=n(47699),J=n(54852),G=n(17739),K=n(57487),B=n(84123),Y=function(){var e=(0,K.v)().scrollY,t=(0,B._)(),n={position:"absolute",top:60,width:386};return e.onChange((function(e){t.start(e?{position:"fixed",top:"50%",width:340}:n)})),y.createElement(W.E.div,{style:{right:0},initial:n,animate:t},y.createElement(X,null))},Q=function(){return y.createElement("div",{style:{width:"100%"}},y.createElement(X,null))},X=function(){return y.createElement(_.Z,{style:{height:"8rem",margin:".5rem",padding:".7rem 1rem 0rem",backgroundColor:"#ffffff00",backdropFilter:"blur(1px)",borderRadius:"2rem",zIndex:1,fontFamily:'"Cascadia Code", sans-serif'},elevation:8},y.createElement(G.Z,{className:"installationTabs"},y.createElement(J.Z,{value:"node",default:!0},y.createElement(G.Z,{className:"subTabs"},y.createElement(J.Z,{value:"npm",attributes:{className:"npmTab"}},y.createElement(Z.Z,{language:"bash"},"npm install arktype")),y.createElement(J.Z,{value:"pnpm",attributes:{className:"pnpmTab"}},y.createElement(Z.Z,{language:"bash"},"pnpm add arktype")),y.createElement(J.Z,{value:"yarn",attributes:{className:"yarnTab"}},y.createElement(Z.Z,{language:"bash"},"yarn add arktype")))),y.createElement(J.Z,{value:"bun",label:"bun"},y.createElement(Z.Z,{language:"bash"},"bun install arktype")),y.createElement(J.Z,{value:"deno",label:"deno"},y.createElement(Z.Z,{language:"typescript"},'import { type } from "npm:arktype"'))))},ee=function(){var e=(0,b.I)().colorMode;return y.createElement("main",{style:{display:"flex",justifyContent:"center"}},y.createElement(v.Z,{justifyContent:"center",padding:"1rem 0rem 1rem",spacing:1,width:"100%",maxWidth:"60rem"},y.createElement(V,null),(0,T.Z)("(min-width:1420px)")?y.createElement(Y,null):y.createElement(Q,null),y.createElement(E.Z,{color:"dark"===e?"primary.light":"primary.dark",className:"contents",fontSize:"1.3rem"},y.createElement("p",null,"ArkType is a runtime validation library that can infer"," ",y.createElement("b",null,"TypeScript definitions 1:1")," and reuse them as"," ",y.createElement("b",null,"highly-optimized validators")," for your data."),y.createElement("p",null,"With each character you type, you'll get"," ",y.createElement("b",null,"immediate feedback from your editor")," in the form of either a fully-inferred ",y.createElement("code",null,"Type")," or a specific and helpful ",y.createElement("code",null,"ParseError"),"."),y.createElement("p",null,"This result exactly mirrors what you can expect to happen at runtime down to the punctuation of the error message- ",y.createElement("b",null,"no plugins required"),".")),y.createElement(P,null)))},te=["title","titleId"];function ne(){return ne=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}const ae=function(e){var t=e.title,n=e.titleId,f=re(e,te);return y.createElement("svg",ne({viewBox:"0 0 375 375","aria-labelledby":n},f),t?y.createElement("title",{id:n},t):null,r||(r=y.createElement("path",{fill:"#4b3621",d:"M5.314 281.357h27.799l9.62-38.835a5.288 5.337 0 0 1 5.156-4.077h212.609a5.288 5.337 0 0 1 5.156 4.077l9.461 38.3 37.844-4.775c1.754-.268 3.508.43 4.678 1.824 1.169 1.34 1.542 3.218 1.063 4.935l-10.63 37.548a5.295 5.344 0 0 1-5.103 3.916H5.315c-2.923 0-5.316-2.414-5.316-5.364V286.72c0-2.95 2.391-5.364 5.315-5.364Zm127.566-32.184H52.035l-7.972 32.184h88.817zm31.89 0h-21.26v32.184h21.26zm91.582 0h-80.95v32.184h88.923zM10.63 313.542h288.35l7.283-25.855-34.55 4.344c-.212.054-.425.054-.637.054H10.629v21.457z"})),a||(a=y.createElement("path",{fill:"none",d:"M106.994 267.84a5.281 5.33 0 0 0 4.624 2.789c.904 0 1.754-.215 2.604-.697a5.358 5.358 0 0 0 2.073-7.296c-1.435-2.574-4.624-3.54-7.229-2.092-2.55 1.449-3.507 4.72-2.072 7.296zm-43.212-2.575c0 2.95 2.338 5.364 5.262 5.364h.052c2.924 0 5.316-2.414 5.316-5.364 0-2.95-2.392-5.364-5.316-5.364-2.923 0-5.314 2.413-5.314 5.364zm127.671.805c.425 2.628 2.658 4.56 5.262 4.56.266 0 .531 0 .797-.054 2.87-.43 4.943-3.165 4.465-6.115-.426-2.95-3.083-4.989-6.006-4.506h-.053c-2.87.428-4.89 3.165-4.465 6.114zm21.155-.805c0 2.95 2.391 5.364 5.315 5.364 2.924 0 5.369-2.414 5.369-5.364 0-2.95-2.392-5.364-5.316-5.364h-.053c-2.923 0-5.315 2.413-5.315 5.364zm-127.566 0c0 2.95 2.339 5.364 5.262 5.364h.053c2.923 0 5.316-2.414 5.316-5.364 0-2.95-2.392-5.364-5.316-5.364s-5.315 2.413-5.315 5.364zm152.866 5.203a5.232 5.28 0 0 0 1.276.161 5.284 5.284 0 0 0 5.156-4.077c.744-2.843-.957-5.793-3.827-6.49h-.053c-2.87-.698-5.74 1.018-6.432 3.916a5.39 5.39 0 0 0 3.88 6.49z"})),i||(i=y.createElement("path",{fill:"none",d:"M182.736 249.173h73.616l6.644 26.82h-80.26Zm55.172 21.295a5.232 5.28 0 0 0 1.276.161 5.284 5.284 0 0 0 5.156-4.077c.744-2.843-.957-5.793-3.827-6.49h-.053c-2.87-.698-5.74 1.018-6.432 3.916a5.39 5.39 0 0 0 3.88 6.49zm-19.985.161c2.923 0 5.369-2.414 5.369-5.364 0-2.95-2.392-5.364-5.316-5.364h-.053c-2.923 0-5.315 2.413-5.315 5.364 0 2.95 2.392 5.364 5.315 5.364zm-21.208 0c.266 0 .532 0 .798-.053 2.87-.43 4.943-3.165 4.464-6.115-.425-2.95-3.082-4.989-6.006-4.506h-.053c-2.87.43-4.89 3.165-4.464 6.115.424 2.627 2.657 4.56 5.262 4.56z"})),o||(o=y.createElement("path",{fill:"none",d:"M182.736 249.173v26.82h80.26l1.329 5.364H175.4v-32.184zm-17.966 0h-13.925v26.82h13.925z"})),l||(l=y.createElement("path",{fill:"none",d:"M150.845 249.173v26.82h13.925v5.364h-21.26v-32.184zm-92.805 0h74.84v26.82H51.397Zm48.954 18.667a5.281 5.33 0 0 0 4.624 2.789c.904 0 1.754-.215 2.604-.697a5.358 5.358 0 0 0 2.073-7.296c-1.435-2.574-4.624-3.54-7.229-2.092-2.55 1.449-3.507 4.72-2.072 7.296zm-16.69 2.79h.053c2.923 0 5.316-2.415 5.316-5.365s-2.392-5.364-5.316-5.364-5.315 2.413-5.315 5.364c0 2.95 2.34 5.364 5.262 5.364zm-21.26 0h.052c2.924 0 5.316-2.415 5.316-5.365s-2.392-5.364-5.316-5.364c-2.923 0-5.315 2.413-5.315 5.364 0 2.95 2.34 5.364 5.262 5.364z"})),c||(c=y.createElement("path",{fill:"none",d:"M52.035 249.173h6.006l-6.644 26.82h81.483v5.364H44.062Zm-34.071 42.912h253.111c.213 0 .426 0 .638-.053l34.55-4.345-5.773 20.49H17.964Z"})),s||(s=y.createElement("path",{fill:"none",d:"m300.49 308.178-1.51 5.364zM17.964 292.085v16.093H300.49l-1.51 5.364H10.63v-21.457z"})),m||(m=y.createElement("path",{fill:"none",d:"M10.934 302.813v-10.728l131.358.01 131.358.01 15.636-1.955c8.6-1.076 15.786-1.805 15.968-1.621.182.184-1.236 5.887-3.152 12.674l-3.485 12.34H10.934Z"})),p||(p=y.createElement("path",{fill:"#eb9f2e",d:"M11.237 302.813v-10.728l132.573-.01 132.573-.01 12.453-1.519c14.274-1.741 15.793-1.814 15.794-.759 0 .422-1.407 5.939-3.128 12.26l-3.13 11.495H11.238Z"})),d||(d=y.createElement("path",{fill:"none",d:"M44.664 280.591c.009-.253 1.734-7.356 3.834-15.785l3.817-15.326 40.205-.157 40.205-.158v31.886h-44.04c-24.221 0-44.031-.207-44.021-.46zm28.34-11.294c1.408-1.335 1.898-4.63 1.03-6.916-.493-1.295-3.389-2.786-5.41-2.786-2.105 0-5.147 3.07-5.147 5.194 0 1.889 1.463 4.981 2.569 5.43 2.048.832 5.606.36 6.959-.922zm21.261 0c1.407-1.335 1.898-4.63 1.029-6.916-.493-1.295-3.389-2.786-5.41-2.786-2.105 0-5.147 3.07-5.147 5.194 0 1.889 1.463 4.981 2.569 5.43 2.049.832 5.606.36 6.959-.922zm20.992.12c1.898-1.506 2.42-4.01 1.367-6.554-.942-2.274-2.512-3.268-5.167-3.268-2.42 0-5.46 2.891-5.46 5.194 0 1.889 1.463 4.981 2.57 5.43 1.852.752 5.245.346 6.69-.802zm28.401-4.305v-15.938h20.653v31.876h-20.653z"})),u||(u=y.createElement("path",{fill:"#eb9f2e",d:"M175.852 265.112v-15.938h80.135l.6 2.299c.33 1.264 1.993 7.953 3.694 14.865 1.702 6.912 3.237 13.05 3.413 13.64.301 1.015-2.064 1.073-43.761 1.073h-44.08Zm24.73 4.138c1.832-2.02 2.163-3.777 1.165-6.189-1.626-3.926-5.907-4.728-8.933-1.674-1.989 2.007-2.257 4.073-.877 6.765 1.064 2.077 1.647 2.365 4.918 2.429 1.832.036 2.801-.31 3.727-1.33zm21.246 0c1.735-1.934 2.089-3.992 1.098-6.384-1.495-3.61-5.994-4.363-8.852-1.479-1.988 2.007-2.256 4.073-.877 6.765 1.064 2.077 1.647 2.365 4.918 2.429 1.836.036 2.796-.308 3.713-1.33zm21.259.047c1.038-.985 1.406-2.009 1.406-3.917 0-3.434-1.442-5.155-4.685-5.594-2.255-.305-2.757-.131-4.397 1.524-2.067 2.086-2.35 4.117-.954 6.842 1.06 2.067 1.651 2.365 4.833 2.429 1.666.034 2.817-.356 3.797-1.284zm-99.429-4.185v-15.938h20.653v31.876h-20.653zm-78.814 15.479c-10.775-.094-19.59-.408-19.59-.699 0-.797 7.103-29.51 7.366-29.774.125-.127 18.2-.322 40.166-.434l39.939-.204v31.571l-24.146-.145c-13.28-.079-32.961-.22-43.735-.315Zm7.764-10.585c1.609-.87 2.585-4.818 1.772-7.171-1.21-3.501-6.312-4.384-9.2-1.593-1.966 1.902-2.253 4.697-.776 7.579.84 1.64 1.212 1.808 3.988 1.808 1.684 0 3.58-.28 4.216-.623zm21.26 0c1.61-.87 2.585-4.818 1.772-7.171-1.21-3.501-6.312-4.384-9.2-1.593-1.966 1.902-2.253 4.697-.776 7.579.84 1.64 1.212 1.808 3.988 1.808 1.684 0 3.581-.28 4.216-.623zm21.833-.587c1.661-1.676 2.08-3.852 1.24-6.424-.847-2.588-2.125-3.4-5.354-3.4-4.654 0-7.006 4.654-4.663 9.226.855 1.668 1.184 1.808 4.252 1.808 2.501 0 3.623-.3 4.525-1.21z"})))};var ie=function(){for(var e,t,n,r=(e=(0,y.useState)({width:globalThis.innerWidth,height:globalThis.innerHeight}),t=e[0],n=e[1],(0,y.useEffect)((function(){var e=function(){n({width:window.innerWidth,height:window.innerHeight})};return window.addEventListener("resize",e),function(){window.removeEventListener("resize",e)}}),[]),t).width/16,a=[],i=0;i{n.r(t),n.d(t,{default:()=>i});var r=n(29901),a=n(99269);const i=function(){return r.createElement(a.default,null)}}}]); \ No newline at end of file diff --git a/assets/js/runtime~main.4a02a84b.js b/assets/js/runtime~main.cb630930.js similarity index 87% rename from assets/js/runtime~main.4a02a84b.js rename to assets/js/runtime~main.cb630930.js index 4e4e274771..050863eaaa 100644 --- a/assets/js/runtime~main.4a02a84b.js +++ b/assets/js/runtime~main.cb630930.js @@ -1 +1 @@ -(()=>{"use strict";var e,a,b,f,d,c={},t={};function r(e){var a=t[e];if(void 0!==a)return a.exports;var b=t[e]={id:e,loaded:!1,exports:{}};return c[e].call(b.exports,b,b.exports,r),b.loaded=!0,b.exports}r.m=c,r.c=t,e=[],r.O=(a,b,f,d)=>{if(!b){var c=1/0;for(i=0;i=d)&&Object.keys(r.O).every((e=>r.O[e](b[o])))?b.splice(o--,1):(t=!1,d0&&e[i-1][2]>d;i--)e[i]=e[i-1];e[i]=[b,f,d]},r.n=e=>{var a=e&&e.__esModule?()=>e.default:()=>e;return r.d(a,{a:a}),a},b=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,r.t=function(e,f){if(1&f&&(e=this(e)),8&f)return e;if("object"==typeof e&&e){if(4&f&&e.__esModule)return e;if(16&f&&"function"==typeof e.then)return e}var d=Object.create(null);r.r(d);var c={};a=a||[null,b({}),b([]),b(b)];for(var t=2&f&&e;"object"==typeof t&&!~a.indexOf(t);t=b(t))Object.getOwnPropertyNames(t).forEach((a=>c[a]=()=>e[a]));return c.default=()=>e,r.d(d,c),d},r.d=(e,a)=>{for(var b in a)r.o(a,b)&&!r.o(e,b)&&Object.defineProperty(e,b,{enumerable:!0,get:a[b]})},r.f={},r.e=e=>Promise.all(Object.keys(r.f).reduce(((a,b)=>(r.f[b](e,a),a)),[])),r.u=e=>"assets/js/"+({3:"218a10b7",15:"661942b6",33:"c1566c80",53:"935f2afb",173:"64b0bc0b",215:"20bbe3a4",253:"d08a5cd9",267:"0a7973dc",279:"a0f38637",295:"a15d4918",308:"b21dc314",309:"39fabe63",343:"b207f374",344:"4bc2b917",352:"6b600ad8",397:"4c51d941",400:"a7d4f0a4",408:"66d34ef6",440:"9b8bb8a5",504:"261d4567",508:"c9cdb2cd",513:"c40baa2c",570:"446de14b",582:"664634ec",589:"6a98dd43",610:"f2fd9995",663:"3f475d74",709:"cc78971e",711:"9cf30a74",712:"7f741c26",863:"54a2e480",874:"6f3866ae",996:"e8871c82",1011:"4d0232ca",1052:"56ebe7ce",1066:"04e96f40",1079:"ccfb1236",1113:"37b029e4",1144:"712be200",1211:"d41cdbd4",1228:"e2461dfd",1268:"e0823295",1269:"dc9876d0",1272:"b24ac1a1",1370:"90a8d724",1384:"ccac430f",1386:"95dbee80",1393:"e7930c82",1403:"632d73df",1405:"36a3925a",1415:"b51773d7",1422:"c897f273",1464:"402d9ac3",1488:"f3accd90",1531:"02c148a9",1567:"3e74f845",1638:"50afdaae",1711:"a66fa827",1712:"c6782734",1741:"64a3c6e9",1749:"3c576763",1787:"e87af240",1790:"95ee4656",1800:"9ec264b0",1845:"79bbd73f",1874:"e593da58",1921:"e1c5356f",1947:"8a580bbd",1983:"d4983bd7",2048:"1ebef08a",2056:"dfc31940",2064:"77b85fcc",2065:"3ca54c20",2078:"44ad23ca",2087:"44abb010",2111:"fa5b3c64",2134:"17c9add8",2154:"04ca6b23",2155:"25c35c86",2206:"337a97bf",2216:"00cf5318",2227:"4fc4d3de",2269:"90c008eb",2310:"2d805ff0",2363:"b559d85e",2369:"a6052a4b",2370:"52828006",2382:"15c910ba",2488:"ed2f6e2d",2505:"aa2edfac",2542:"412337c1",2576:"ed32b608",2651:"0be3f0b3",2659:"201eb429",2670:"9b5b2f56",2708:"7b812af0",2718:"7db05580",2719:"3cd667ef",2737:"e59dc82a",2761:"d20ea9cb",2889:"49fb3aca",2965:"886330fc",2967:"83d426d9",2979:"9939f002",3038:"9021a768",3049:"12bb9ce5",3050:"51a477b6",3126:"7b5196a1",3140:"9d12f58b",3207:"c96b1a52",3220:"d9e6bfd2",3237:"1df93b7f",3246:"11b4899c",3311:"699e8c65",3332:"693c4f31",3345:"0a1349f1",3352:"afb4c8d0",3398:"bf9eb72b",3428:"e34113ea",3431:"52f9fd70",3559:"114efe75",3597:"6d2bdafa",3627:"456f8f16",3631:"d64ec25b",3645:"6543d709",3678:"dda49074",3683:"90f9de61",3708:"70865799",3709:"f981804c",3718:"0f59f13c",3801:"71aeac4f",3838:"83647aeb",3881:"9b8157dc",3908:"71bbc623",4020:"b0266a2e",4021:"f5450a53",4032:"a8d7e975",4041:"f4ab0997",4064:"d939c4cf",4069:"cc0af677",4173:"4edc808e",4174:"0efbc173",4204:"720b32b8",4274:"a8443108",4278:"74013e48",4336:"60f4de08",4378:"33fa3649",4405:"af2e9fab",4425:"c82ee514",4447:"8fb3568e",4467:"cc8f130c",4468:"b527fae2",4514:"17a90253",4557:"506c0445",4560:"e53c2488",4571:"954d46d2",4578:"fca6815f",4582:"598efede",4597:"339d3c17",4603:"4f719b32",4616:"819b7bff",4643:"0a61f398",4644:"288a554d",4665:"0493d4c1",4717:"c9964daf",4753:"6b6373f3",4770:"92662164",4785:"7544a8d8",4888:"01a43ec3",4910:"3a4716de",4946:"85d86f40",4990:"0a39420a",4992:"0976b861",4998:"f4d4ef5a",5e3:"489af003",5024:"c96bd749",5095:"139f3ccb",5105:"d8893250",5124:"10bb0f04",5180:"422620c1",5185:"717abbec",5239:"bf95da2e",5266:"80a2bf09",5324:"574c3876",5348:"bc5f4b18",5381:"893c3ed1",5512:"8e36631c",5520:"4f91d1fa",5548:"cb67f2be",5557:"47b88856",5637:"629b5b90",5656:"af55ed38",5685:"b45a700f",5688:"3c1eb414",5722:"6b349b64",5732:"d8bba269",5737:"8417b59e",5783:"ea0f6b3f",5786:"c3541e9e",5787:"12140a58",5804:"77ef4de7",5820:"4edc9ce5",5834:"2378f488",5835:"d34d80a4",5843:"e48be19d",5966:"d043b015",5981:"a1b4c482",6075:"119c85c3",6080:"59058b9c",6084:"4a6ff42c",6101:"0d0d98a4",6119:"eb3ac9bb",6124:"de63dc90",6155:"7b1099f0",6166:"28b74367",6184:"ea18a43c",6250:"62542541",6284:"2bea6d8f",6377:"db25c6b2",6397:"7955d848",6412:"c3aabb3b",6418:"05dfa499",6465:"f56e57b8",6491:"c7123966",6580:"26c0ba22",6583:"66ab3f82",6587:"9a9123fd",6606:"b3f033ae",6641:"dc29efe7",6651:"f6abc386",6683:"e9636bdb",6694:"1cd1dcad",6696:"fa1e6577",6711:"e9e96877",6731:"9d30d1b5",6746:"8122d123",6751:"3da5c09b",6840:"5f7bc296",6843:"6309a6fc",6849:"f4577cf2",6871:"816edea5",6893:"ed756b6e",6900:"c1789402",6927:"35c73967",6954:"431f3670",6956:"10ae884d",6963:"3ea57330",6966:"c7722782",6971:"4c239821",6996:"f042813e",7019:"1915fe21",7071:"c00cc6b2",7098:"e17acbb0",7119:"612311ec",7162:"1602d5a7",7198:"193ee87b",7218:"f7d9de65",7252:"e535037a",7297:"79d70776",7361:"cd758b8d",7375:"5c45db8c",7393:"84389d4b",7399:"6bb186f5",7447:"7cdde229",7456:"e655abbb",7467:"def5e568",7570:"861ccb4a",7600:"2461ffa2",7606:"07cf2946",7609:"54746c5d",7621:"dbd74e1e",7625:"412eae58",7690:"c62ebc34",7691:"ef2d7b11",7757:"704654aa",7760:"cb0719ba",7801:"ef111452",7806:"f0d09dc7",7893:"eb697851",7918:"17896441",7919:"3a7be745",7920:"78815324",7925:"de14bdb8",7957:"fa190965",8011:"d78396ad",8202:"29e92f5e",8209:"bfd22999",8235:"df4b4745",8253:"0f77207c",8278:"8b6844fb",8410:"91c230ff",8443:"a6750165",8461:"3bd62677",8490:"8565c7f1",8491:"6fdaf75b",8494:"ac907d5b",8584:"b4d00006",8652:"13e267d5",8666:"336b3993",8709:"0bd12973",8727:"82b3c1af",8764:"9250bde8",8799:"845e825f",8810:"3437bd2a",8820:"859a2b4a",8862:"b3ff9d4c",8871:"f5cf1540",8877:"ca783dc8",8879:"f2d81eea",8914:"b7eb6f82",9172:"c1d314a1",9184:"5179419d",9197:"55fbe152",9219:"990740a9",9291:"7106c5f4",9293:"3c3913a6",9331:"8ebd8584",9357:"ae6a1a09",9368:"b8be6a81",9370:"14af8986",9385:"ff4199e5",9395:"f90a1385",9408:"d804be0b",9460:"ec95bee0",9461:"1ed0e172",9514:"1be78505",9531:"f8cd29e9",9549:"336ac60a",9571:"b7645ba4",9594:"7caf366c",9604:"5a806f6c",9627:"d3ad1999",9633:"e7d10b2a",9655:"4d157327",9667:"e8bf6104",9681:"e6d2a166",9751:"094d205f",9780:"0dbc098c",9800:"fb9b701d",9802:"6a5e2130",9839:"869384d8",9910:"210bc92c",9964:"91ed0e08",9971:"f77690a0"}[e]||e)+"."+{3:"65da5ac1",15:"1bbfa626",33:"ad69bde8",53:"f8ffe151",173:"4c237303",215:"42ebfc89",253:"5cc1fe7f",267:"7dfa0829",279:"dbb13357",295:"f6adce0f",308:"596535c7",309:"9b95e9ad",343:"c9a1648e",344:"576ec35f",352:"06d40f4c",397:"48a7acdc",400:"bf888a1a",408:"94422d48",440:"7e5ef358",504:"bf132f26",508:"1689c314",513:"fcd23e83",570:"e6973f52",582:"25fe7573",589:"88145ccd",610:"87cd5312",663:"7333856c",709:"d161d346",711:"22e13430",712:"f7beb387",856:"b17206ce",863:"a155aaba",874:"2389d02c",996:"321a638e",1011:"d9f59f3d",1052:"4dcd837e",1066:"86285a54",1079:"9b25d88e",1113:"1b674bcf",1144:"c9e70368",1211:"669a3488",1228:"0e7077b3",1268:"b49c0b67",1269:"54628cbf",1272:"cf573fd1",1370:"5c15755f",1384:"9cd444d4",1386:"d20b5917",1393:"1c108252",1403:"435419d9",1405:"d48bc518",1415:"7bf11a82",1422:"4a1bdea8",1464:"5f52d1bb",1488:"e5359f25",1531:"35801cdb",1567:"7b32f11c",1638:"51b96a91",1711:"4db33fd7",1712:"a48fa673",1741:"d8ba1cf4",1749:"d76eb5ff",1787:"1d0ee935",1790:"e125de81",1800:"01362d11",1845:"d75b837f",1874:"353c470e",1921:"dd9a3e1b",1947:"5a7bdd86",1983:"94d598eb",2048:"98e29072",2056:"0e26adbb",2064:"b1198612",2065:"d2d87d53",2078:"ab4f59b2",2087:"d59cfa39",2111:"24f57e35",2134:"3c68727c",2154:"4810acc9",2155:"54851612",2206:"04a5730e",2216:"8a125eb9",2227:"06b04483",2269:"fd8f8f16",2310:"68681345",2363:"b746103c",2369:"a9bc5aa8",2370:"99814294",2382:"9ecf4cef",2488:"e73880c4",2505:"8ad14b3a",2523:"4b1e782e",2542:"21bf32a6",2576:"97f1b5cd",2651:"d6273192",2659:"a4086cb4",2670:"1518daaf",2708:"a9326e04",2718:"60207401",2719:"e427baf5",2737:"755afef7",2761:"ff191d63",2889:"2b204c5c",2965:"6757514d",2967:"f98c3402",2979:"4a2113b8",3038:"a92d762a",3049:"db7681d3",3050:"b9da20c3",3126:"b7b6486b",3140:"9d83efe7",3207:"c29ad051",3220:"f4e1eb64",3237:"0f5036cb",3246:"03eb6f95",3311:"8fc47125",3332:"f0b4b736",3345:"1f02ddfd",3352:"73840524",3398:"3558de0e",3428:"225bd274",3431:"c369fc6b",3559:"013e8d5f",3597:"e4593452",3627:"f0cc5a4a",3631:"8080bd51",3645:"deb23e80",3678:"4a181198",3683:"7bc52722",3708:"e3cd9629",3709:"c4799ce7",3718:"50300ce7",3801:"93ef644a",3838:"e03c83d5",3881:"e2b95b6d",3908:"cb8a935e",4020:"f1af4b15",4021:"b0663828",4032:"cd55147a",4041:"cbaabbb2",4064:"f1db1b36",4069:"21839983",4173:"5a6404f7",4174:"d6739651",4204:"c353ca3c",4274:"f321993d",4278:"388a6439",4336:"a9b84dd9",4378:"aad1c0a7",4405:"0667831a",4425:"350498d6",4447:"0f0e0ddb",4467:"fdd26404",4468:"edc9e00b",4514:"9380c455",4557:"10fcd01c",4560:"b6420f3c",4571:"9e71a449",4578:"f0f448c1",4582:"1edc0c86",4597:"58378872",4603:"4b1a69f7",4616:"360ac698",4643:"1f4adb21",4644:"e41a823a",4665:"f1ccfaa7",4717:"9b87fed2",4753:"28eceb2c",4770:"ed89ea97",4785:"8934558c",4888:"22dab72e",4910:"17d7a05a",4946:"823611f3",4990:"9568ee44",4992:"8d23b6de",4998:"5d129fa8",5e3:"661bdefe",5024:"9d77f730",5095:"c191f61c",5105:"e131b876",5124:"b95d06c9",5180:"3447f7c0",5185:"ecea1136",5239:"f89c6678",5266:"69d0050b",5324:"3ad4af8d",5348:"a353176c",5381:"5aafde02",5512:"921fd6f0",5520:"9f0b914e",5548:"b1fee80f",5557:"dc5f94ed",5637:"ca51737e",5656:"b5913255",5685:"f4d485b7",5688:"8e6fddad",5722:"723206a6",5732:"45060b17",5737:"1308435f",5783:"b8457f89",5786:"e20caff8",5787:"8c8282f6",5804:"bd5520cd",5820:"b4f65098",5834:"8d0eeb03",5835:"46379345",5843:"7cf64a56",5966:"29650cd6",5981:"4da81902",6075:"a488cc3d",6080:"651580dc",6084:"bf90a0d3",6101:"75f8b08f",6119:"38840acb",6124:"737d8a8c",6155:"1f2354d6",6166:"40eb9f57",6184:"01e05ac2",6250:"49d25d5f",6273:"63241f51",6284:"b0649046",6377:"f5eb4570",6397:"efe90783",6412:"47ae253b",6418:"66f99f5a",6465:"20f72335",6491:"e08268f4",6580:"d3413c83",6583:"9911236d",6587:"99727228",6606:"ea8efb53",6641:"1b1cc604",6651:"42064187",6683:"4a766a4d",6694:"20e5bf8d",6696:"4f0c2a38",6711:"b42da8cd",6731:"db4081d7",6746:"a0cc84f9",6751:"80209ba1",6840:"34dce987",6843:"db7f50ae",6849:"392cabc8",6871:"671693e0",6893:"fb2e34fb",6900:"6541bc80",6927:"6f57f850",6954:"39c13a8a",6956:"31e2f7bd",6963:"b6e23bb2",6966:"e87e13ef",6971:"ca8c7782",6996:"f5087739",7019:"5e5fa5fc",7071:"afa5a8be",7098:"7b3b2f2f",7119:"b4b4b5be",7162:"ae254b36",7198:"8083cb50",7218:"6b0a10b1",7252:"d92e37c0",7297:"38adef22",7361:"6ef64c37",7375:"8279ac63",7393:"7e92f5e8",7399:"e3bb505f",7447:"2ff0a141",7456:"1205a734",7467:"88d2e4ae",7570:"9c13449b",7600:"1ac75160",7606:"b9c1de1b",7609:"4c93f012",7621:"1aa60827",7625:"d47f8b24",7690:"73328b36",7691:"67e3afba",7757:"aeb78aeb",7760:"f2db7b74",7801:"0e3fe62a",7806:"3d6d53a2",7893:"10843699",7918:"0ce223b6",7919:"cf0648ef",7920:"64dbd86f",7925:"8e8753df",7957:"ce6561ac",8011:"18bf5d44",8202:"a77c0ec1",8209:"87d54b2b",8235:"d299d342",8253:"793aa540",8278:"d391d3d6",8311:"778cb220",8410:"ae4f1fc2",8443:"a07d66a7",8461:"c5729171",8490:"37d27148",8491:"9bb75992",8494:"0e99e90a",8584:"f4e1eb05",8652:"1920fc89",8666:"537a8728",8709:"5c17069d",8727:"076df8d4",8764:"73e6dbd7",8799:"c0a94bde",8810:"cd3dfa6e",8820:"5fed82ea",8862:"b4acdf17",8871:"88ac6cf9",8877:"2e699234",8879:"a682b7a1",8914:"ea2c71f7",9172:"8f374c1c",9184:"c904a7b8",9197:"6dc9c340",9219:"c81eea10",9291:"af2b16e5",9293:"3dd6db3c",9331:"d7a998f3",9357:"cda771bf",9368:"413824df",9370:"ccd6bfc6",9385:"3e54da02",9395:"3259293f",9408:"b474d2bd",9460:"c762fb1c",9461:"bf7de94a",9514:"26e8b616",9531:"680f2cfb",9549:"b8c39294",9571:"6cca1b93",9594:"8681af58",9604:"7bc8622c",9627:"d77b0af9",9633:"8521d623",9655:"6a9901b0",9667:"0262adb4",9681:"5dda0e12",9751:"bd615ea9",9780:"8ff5a2f0",9800:"e4ee2eee",9802:"a2d7edf9",9839:"ed7883d7",9910:"e30b42bc",9964:"25af1c42",9971:"bcdcdf42"}[e]+".js",r.miniCssF=e=>{},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,a)=>Object.prototype.hasOwnProperty.call(e,a),f={},d="arktype.io:",r.l=(e,a,b,c)=>{if(f[e])f[e].push(a);else{var t,o;if(void 0!==b)for(var n=document.getElementsByTagName("script"),i=0;i{t.onerror=t.onload=null,clearTimeout(s);var d=f[e];if(delete f[e],t.parentNode&&t.parentNode.removeChild(t),d&&d.forEach((e=>e(b))),a)return a(b)},s=setTimeout(l.bind(null,void 0,{type:"timeout",target:t}),12e4);t.onerror=l.bind(null,t.onerror),t.onload=l.bind(null,t.onload),o&&document.head.appendChild(t)}},r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.p="/",r.gca=function(e){return e={17896441:"7918",52828006:"2370",62542541:"6250",70865799:"3708",78815324:"7920",92662164:"4770","218a10b7":"3","661942b6":"15",c1566c80:"33","935f2afb":"53","64b0bc0b":"173","20bbe3a4":"215",d08a5cd9:"253","0a7973dc":"267",a0f38637:"279",a15d4918:"295",b21dc314:"308","39fabe63":"309",b207f374:"343","4bc2b917":"344","6b600ad8":"352","4c51d941":"397",a7d4f0a4:"400","66d34ef6":"408","9b8bb8a5":"440","261d4567":"504",c9cdb2cd:"508",c40baa2c:"513","446de14b":"570","664634ec":"582","6a98dd43":"589",f2fd9995:"610","3f475d74":"663",cc78971e:"709","9cf30a74":"711","7f741c26":"712","54a2e480":"863","6f3866ae":"874",e8871c82:"996","4d0232ca":"1011","56ebe7ce":"1052","04e96f40":"1066",ccfb1236:"1079","37b029e4":"1113","712be200":"1144",d41cdbd4:"1211",e2461dfd:"1228",e0823295:"1268",dc9876d0:"1269",b24ac1a1:"1272","90a8d724":"1370",ccac430f:"1384","95dbee80":"1386",e7930c82:"1393","632d73df":"1403","36a3925a":"1405",b51773d7:"1415",c897f273:"1422","402d9ac3":"1464",f3accd90:"1488","02c148a9":"1531","3e74f845":"1567","50afdaae":"1638",a66fa827:"1711",c6782734:"1712","64a3c6e9":"1741","3c576763":"1749",e87af240:"1787","95ee4656":"1790","9ec264b0":"1800","79bbd73f":"1845",e593da58:"1874",e1c5356f:"1921","8a580bbd":"1947",d4983bd7:"1983","1ebef08a":"2048",dfc31940:"2056","77b85fcc":"2064","3ca54c20":"2065","44ad23ca":"2078","44abb010":"2087",fa5b3c64:"2111","17c9add8":"2134","04ca6b23":"2154","25c35c86":"2155","337a97bf":"2206","00cf5318":"2216","4fc4d3de":"2227","90c008eb":"2269","2d805ff0":"2310",b559d85e:"2363",a6052a4b:"2369","15c910ba":"2382",ed2f6e2d:"2488",aa2edfac:"2505","412337c1":"2542",ed32b608:"2576","0be3f0b3":"2651","201eb429":"2659","9b5b2f56":"2670","7b812af0":"2708","7db05580":"2718","3cd667ef":"2719",e59dc82a:"2737",d20ea9cb:"2761","49fb3aca":"2889","886330fc":"2965","83d426d9":"2967","9939f002":"2979","9021a768":"3038","12bb9ce5":"3049","51a477b6":"3050","7b5196a1":"3126","9d12f58b":"3140",c96b1a52:"3207",d9e6bfd2:"3220","1df93b7f":"3237","11b4899c":"3246","699e8c65":"3311","693c4f31":"3332","0a1349f1":"3345",afb4c8d0:"3352",bf9eb72b:"3398",e34113ea:"3428","52f9fd70":"3431","114efe75":"3559","6d2bdafa":"3597","456f8f16":"3627",d64ec25b:"3631","6543d709":"3645",dda49074:"3678","90f9de61":"3683",f981804c:"3709","0f59f13c":"3718","71aeac4f":"3801","83647aeb":"3838","9b8157dc":"3881","71bbc623":"3908",b0266a2e:"4020",f5450a53:"4021",a8d7e975:"4032",f4ab0997:"4041",d939c4cf:"4064",cc0af677:"4069","4edc808e":"4173","0efbc173":"4174","720b32b8":"4204",a8443108:"4274","74013e48":"4278","60f4de08":"4336","33fa3649":"4378",af2e9fab:"4405",c82ee514:"4425","8fb3568e":"4447",cc8f130c:"4467",b527fae2:"4468","17a90253":"4514","506c0445":"4557",e53c2488:"4560","954d46d2":"4571",fca6815f:"4578","598efede":"4582","339d3c17":"4597","4f719b32":"4603","819b7bff":"4616","0a61f398":"4643","288a554d":"4644","0493d4c1":"4665",c9964daf:"4717","6b6373f3":"4753","7544a8d8":"4785","01a43ec3":"4888","3a4716de":"4910","85d86f40":"4946","0a39420a":"4990","0976b861":"4992",f4d4ef5a:"4998","489af003":"5000",c96bd749:"5024","139f3ccb":"5095",d8893250:"5105","10bb0f04":"5124","422620c1":"5180","717abbec":"5185",bf95da2e:"5239","80a2bf09":"5266","574c3876":"5324",bc5f4b18:"5348","893c3ed1":"5381","8e36631c":"5512","4f91d1fa":"5520",cb67f2be:"5548","47b88856":"5557","629b5b90":"5637",af55ed38:"5656",b45a700f:"5685","3c1eb414":"5688","6b349b64":"5722",d8bba269:"5732","8417b59e":"5737",ea0f6b3f:"5783",c3541e9e:"5786","12140a58":"5787","77ef4de7":"5804","4edc9ce5":"5820","2378f488":"5834",d34d80a4:"5835",e48be19d:"5843",d043b015:"5966",a1b4c482:"5981","119c85c3":"6075","59058b9c":"6080","4a6ff42c":"6084","0d0d98a4":"6101",eb3ac9bb:"6119",de63dc90:"6124","7b1099f0":"6155","28b74367":"6166",ea18a43c:"6184","2bea6d8f":"6284",db25c6b2:"6377","7955d848":"6397",c3aabb3b:"6412","05dfa499":"6418",f56e57b8:"6465",c7123966:"6491","26c0ba22":"6580","66ab3f82":"6583","9a9123fd":"6587",b3f033ae:"6606",dc29efe7:"6641",f6abc386:"6651",e9636bdb:"6683","1cd1dcad":"6694",fa1e6577:"6696",e9e96877:"6711","9d30d1b5":"6731","8122d123":"6746","3da5c09b":"6751","5f7bc296":"6840","6309a6fc":"6843",f4577cf2:"6849","816edea5":"6871",ed756b6e:"6893",c1789402:"6900","35c73967":"6927","431f3670":"6954","10ae884d":"6956","3ea57330":"6963",c7722782:"6966","4c239821":"6971",f042813e:"6996","1915fe21":"7019",c00cc6b2:"7071",e17acbb0:"7098","612311ec":"7119","1602d5a7":"7162","193ee87b":"7198",f7d9de65:"7218",e535037a:"7252","79d70776":"7297",cd758b8d:"7361","5c45db8c":"7375","84389d4b":"7393","6bb186f5":"7399","7cdde229":"7447",e655abbb:"7456",def5e568:"7467","861ccb4a":"7570","2461ffa2":"7600","07cf2946":"7606","54746c5d":"7609",dbd74e1e:"7621","412eae58":"7625",c62ebc34:"7690",ef2d7b11:"7691","704654aa":"7757",cb0719ba:"7760",ef111452:"7801",f0d09dc7:"7806",eb697851:"7893","3a7be745":"7919",de14bdb8:"7925",fa190965:"7957",d78396ad:"8011","29e92f5e":"8202",bfd22999:"8209",df4b4745:"8235","0f77207c":"8253","8b6844fb":"8278","91c230ff":"8410",a6750165:"8443","3bd62677":"8461","8565c7f1":"8490","6fdaf75b":"8491",ac907d5b:"8494",b4d00006:"8584","13e267d5":"8652","336b3993":"8666","0bd12973":"8709","82b3c1af":"8727","9250bde8":"8764","845e825f":"8799","3437bd2a":"8810","859a2b4a":"8820",b3ff9d4c:"8862",f5cf1540:"8871",ca783dc8:"8877",f2d81eea:"8879",b7eb6f82:"8914",c1d314a1:"9172","5179419d":"9184","55fbe152":"9197","990740a9":"9219","7106c5f4":"9291","3c3913a6":"9293","8ebd8584":"9331",ae6a1a09:"9357",b8be6a81:"9368","14af8986":"9370",ff4199e5:"9385",f90a1385:"9395",d804be0b:"9408",ec95bee0:"9460","1ed0e172":"9461","1be78505":"9514",f8cd29e9:"9531","336ac60a":"9549",b7645ba4:"9571","7caf366c":"9594","5a806f6c":"9604",d3ad1999:"9627",e7d10b2a:"9633","4d157327":"9655",e8bf6104:"9667",e6d2a166:"9681","094d205f":"9751","0dbc098c":"9780",fb9b701d:"9800","6a5e2130":"9802","869384d8":"9839","210bc92c":"9910","91ed0e08":"9964",f77690a0:"9971"}[e]||e,r.p+r.u(e)},(()=>{var e={1303:0,532:0};r.f.j=(a,b)=>{var f=r.o(e,a)?e[a]:void 0;if(0!==f)if(f)b.push(f[2]);else if(/^(1303|532)$/.test(a))e[a]=0;else{var d=new Promise(((b,d)=>f=e[a]=[b,d]));b.push(f[2]=d);var c=r.p+r.u(a),t=new Error;r.l(c,(b=>{if(r.o(e,a)&&(0!==(f=e[a])&&(e[a]=void 0),f)){var d=b&&("load"===b.type?"missing":b.type),c=b&&b.target&&b.target.src;t.message="Loading chunk "+a+" failed.\n("+d+": "+c+")",t.name="ChunkLoadError",t.type=d,t.request=c,f[1](t)}}),"chunk-"+a,a)}},r.O.j=a=>0===e[a];var a=(a,b)=>{var f,d,[c,t,o]=b,n=0;if(c.some((a=>0!==e[a]))){for(f in t)r.o(t,f)&&(r.m[f]=t[f]);if(o)var i=o(r)}for(a&&a(b);n{"use strict";var e,b,a,f,d,c={},t={};function r(e){var b=t[e];if(void 0!==b)return b.exports;var a=t[e]={id:e,loaded:!1,exports:{}};return c[e].call(a.exports,a,a.exports,r),a.loaded=!0,a.exports}r.m=c,r.c=t,e=[],r.O=(b,a,f,d)=>{if(!a){var c=1/0;for(i=0;i=d)&&Object.keys(r.O).every((e=>r.O[e](a[o])))?a.splice(o--,1):(t=!1,d0&&e[i-1][2]>d;i--)e[i]=e[i-1];e[i]=[a,f,d]},r.n=e=>{var b=e&&e.__esModule?()=>e.default:()=>e;return r.d(b,{a:b}),b},a=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,r.t=function(e,f){if(1&f&&(e=this(e)),8&f)return e;if("object"==typeof e&&e){if(4&f&&e.__esModule)return e;if(16&f&&"function"==typeof e.then)return e}var d=Object.create(null);r.r(d);var c={};b=b||[null,a({}),a([]),a(a)];for(var t=2&f&&e;"object"==typeof t&&!~b.indexOf(t);t=a(t))Object.getOwnPropertyNames(t).forEach((b=>c[b]=()=>e[b]));return c.default=()=>e,r.d(d,c),d},r.d=(e,b)=>{for(var a in b)r.o(b,a)&&!r.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:b[a]})},r.f={},r.e=e=>Promise.all(Object.keys(r.f).reduce(((b,a)=>(r.f[a](e,b),b)),[])),r.u=e=>"assets/js/"+({3:"218a10b7",15:"661942b6",33:"c1566c80",53:"935f2afb",173:"64b0bc0b",215:"20bbe3a4",253:"d08a5cd9",267:"0a7973dc",279:"a0f38637",295:"a15d4918",308:"b21dc314",309:"39fabe63",343:"b207f374",344:"4bc2b917",352:"6b600ad8",397:"4c51d941",400:"a7d4f0a4",408:"66d34ef6",440:"9b8bb8a5",504:"261d4567",508:"c9cdb2cd",513:"c40baa2c",570:"446de14b",582:"664634ec",589:"6a98dd43",610:"f2fd9995",663:"3f475d74",709:"cc78971e",711:"9cf30a74",712:"7f741c26",863:"54a2e480",874:"6f3866ae",996:"e8871c82",1011:"4d0232ca",1052:"56ebe7ce",1066:"04e96f40",1079:"ccfb1236",1113:"37b029e4",1144:"712be200",1211:"d41cdbd4",1228:"e2461dfd",1268:"e0823295",1269:"dc9876d0",1272:"b24ac1a1",1370:"90a8d724",1384:"ccac430f",1386:"95dbee80",1393:"e7930c82",1403:"632d73df",1405:"36a3925a",1415:"b51773d7",1422:"c897f273",1464:"402d9ac3",1488:"f3accd90",1531:"02c148a9",1567:"3e74f845",1638:"50afdaae",1711:"a66fa827",1712:"c6782734",1741:"64a3c6e9",1749:"3c576763",1787:"e87af240",1790:"95ee4656",1800:"9ec264b0",1845:"79bbd73f",1874:"e593da58",1921:"e1c5356f",1947:"8a580bbd",1983:"d4983bd7",2048:"1ebef08a",2056:"dfc31940",2064:"77b85fcc",2065:"3ca54c20",2078:"44ad23ca",2087:"44abb010",2111:"fa5b3c64",2134:"17c9add8",2154:"04ca6b23",2155:"25c35c86",2206:"337a97bf",2216:"00cf5318",2227:"4fc4d3de",2269:"90c008eb",2310:"2d805ff0",2363:"b559d85e",2369:"a6052a4b",2370:"52828006",2382:"15c910ba",2488:"ed2f6e2d",2505:"aa2edfac",2542:"412337c1",2576:"ed32b608",2651:"0be3f0b3",2659:"201eb429",2670:"9b5b2f56",2708:"7b812af0",2718:"7db05580",2719:"3cd667ef",2737:"e59dc82a",2761:"d20ea9cb",2889:"49fb3aca",2965:"886330fc",2967:"83d426d9",2979:"9939f002",3038:"9021a768",3049:"12bb9ce5",3050:"51a477b6",3126:"7b5196a1",3140:"9d12f58b",3207:"c96b1a52",3220:"d9e6bfd2",3237:"1df93b7f",3246:"11b4899c",3311:"699e8c65",3332:"693c4f31",3345:"0a1349f1",3352:"afb4c8d0",3398:"bf9eb72b",3428:"e34113ea",3431:"52f9fd70",3559:"114efe75",3597:"6d2bdafa",3627:"456f8f16",3631:"d64ec25b",3645:"6543d709",3678:"dda49074",3683:"90f9de61",3708:"70865799",3709:"f981804c",3718:"0f59f13c",3801:"71aeac4f",3838:"83647aeb",3881:"9b8157dc",3908:"71bbc623",4020:"b0266a2e",4021:"f5450a53",4032:"a8d7e975",4041:"f4ab0997",4064:"d939c4cf",4069:"cc0af677",4173:"4edc808e",4174:"0efbc173",4204:"720b32b8",4274:"a8443108",4278:"74013e48",4336:"60f4de08",4378:"33fa3649",4405:"af2e9fab",4425:"c82ee514",4447:"8fb3568e",4467:"cc8f130c",4468:"b527fae2",4514:"17a90253",4557:"506c0445",4560:"e53c2488",4571:"954d46d2",4578:"fca6815f",4582:"598efede",4597:"339d3c17",4603:"4f719b32",4616:"819b7bff",4643:"0a61f398",4644:"288a554d",4665:"0493d4c1",4717:"c9964daf",4753:"6b6373f3",4770:"92662164",4785:"7544a8d8",4888:"01a43ec3",4910:"3a4716de",4946:"85d86f40",4990:"0a39420a",4992:"0976b861",4998:"f4d4ef5a",5e3:"489af003",5024:"c96bd749",5095:"139f3ccb",5105:"d8893250",5124:"10bb0f04",5180:"422620c1",5185:"717abbec",5239:"bf95da2e",5266:"80a2bf09",5324:"574c3876",5348:"bc5f4b18",5381:"893c3ed1",5512:"8e36631c",5520:"4f91d1fa",5548:"cb67f2be",5557:"47b88856",5637:"629b5b90",5656:"af55ed38",5685:"b45a700f",5688:"3c1eb414",5722:"6b349b64",5732:"d8bba269",5737:"8417b59e",5783:"ea0f6b3f",5786:"c3541e9e",5787:"12140a58",5804:"77ef4de7",5820:"4edc9ce5",5834:"2378f488",5835:"d34d80a4",5843:"e48be19d",5966:"d043b015",5981:"a1b4c482",6075:"119c85c3",6080:"59058b9c",6084:"4a6ff42c",6101:"0d0d98a4",6119:"eb3ac9bb",6124:"de63dc90",6155:"7b1099f0",6166:"28b74367",6184:"ea18a43c",6250:"62542541",6284:"2bea6d8f",6377:"db25c6b2",6397:"7955d848",6412:"c3aabb3b",6418:"05dfa499",6465:"f56e57b8",6491:"c7123966",6580:"26c0ba22",6583:"66ab3f82",6587:"9a9123fd",6606:"b3f033ae",6641:"dc29efe7",6651:"f6abc386",6683:"e9636bdb",6694:"1cd1dcad",6696:"fa1e6577",6711:"e9e96877",6731:"9d30d1b5",6746:"8122d123",6751:"3da5c09b",6840:"5f7bc296",6843:"6309a6fc",6849:"f4577cf2",6871:"816edea5",6893:"ed756b6e",6900:"c1789402",6927:"35c73967",6954:"431f3670",6956:"10ae884d",6963:"3ea57330",6966:"c7722782",6971:"4c239821",6996:"f042813e",7019:"1915fe21",7071:"c00cc6b2",7098:"e17acbb0",7119:"612311ec",7162:"1602d5a7",7198:"193ee87b",7218:"f7d9de65",7252:"e535037a",7297:"79d70776",7361:"cd758b8d",7375:"5c45db8c",7393:"84389d4b",7399:"6bb186f5",7447:"7cdde229",7456:"e655abbb",7467:"def5e568",7570:"861ccb4a",7600:"2461ffa2",7606:"07cf2946",7609:"54746c5d",7621:"dbd74e1e",7625:"412eae58",7690:"c62ebc34",7691:"ef2d7b11",7757:"704654aa",7760:"cb0719ba",7801:"ef111452",7806:"f0d09dc7",7893:"eb697851",7918:"17896441",7919:"3a7be745",7920:"78815324",7925:"de14bdb8",7957:"fa190965",8011:"d78396ad",8202:"29e92f5e",8209:"bfd22999",8235:"df4b4745",8253:"0f77207c",8278:"8b6844fb",8410:"91c230ff",8443:"a6750165",8461:"3bd62677",8490:"8565c7f1",8491:"6fdaf75b",8494:"ac907d5b",8584:"b4d00006",8652:"13e267d5",8666:"336b3993",8709:"0bd12973",8727:"82b3c1af",8764:"9250bde8",8799:"845e825f",8810:"3437bd2a",8820:"859a2b4a",8862:"b3ff9d4c",8871:"f5cf1540",8877:"ca783dc8",8879:"f2d81eea",8914:"b7eb6f82",9172:"c1d314a1",9184:"5179419d",9197:"55fbe152",9219:"990740a9",9291:"7106c5f4",9293:"3c3913a6",9331:"8ebd8584",9357:"ae6a1a09",9368:"b8be6a81",9370:"14af8986",9385:"ff4199e5",9395:"f90a1385",9408:"d804be0b",9460:"ec95bee0",9461:"1ed0e172",9514:"1be78505",9531:"f8cd29e9",9549:"336ac60a",9571:"b7645ba4",9594:"7caf366c",9604:"5a806f6c",9627:"d3ad1999",9633:"e7d10b2a",9655:"4d157327",9667:"e8bf6104",9681:"e6d2a166",9751:"094d205f",9780:"0dbc098c",9800:"fb9b701d",9802:"6a5e2130",9839:"869384d8",9910:"210bc92c",9964:"91ed0e08",9971:"f77690a0"}[e]||e)+"."+{3:"65da5ac1",15:"1bbfa626",33:"ad69bde8",53:"f8ffe151",173:"4c237303",215:"42ebfc89",253:"5cc1fe7f",267:"7dfa0829",279:"dbb13357",295:"f6adce0f",308:"596535c7",309:"9b95e9ad",343:"c9a1648e",344:"576ec35f",352:"06d40f4c",397:"48a7acdc",400:"bf888a1a",408:"94422d48",440:"7e5ef358",504:"bf132f26",508:"1689c314",513:"fcd23e83",570:"e6973f52",582:"25fe7573",589:"88145ccd",610:"87cd5312",663:"7333856c",709:"d161d346",711:"22e13430",712:"f7beb387",856:"b17206ce",863:"a155aaba",874:"2389d02c",996:"321a638e",1011:"d9f59f3d",1052:"4dcd837e",1066:"86285a54",1079:"9b25d88e",1113:"1b674bcf",1144:"c9e70368",1211:"669a3488",1228:"0e7077b3",1268:"b49c0b67",1269:"54628cbf",1272:"cf573fd1",1370:"5c15755f",1384:"9cd444d4",1386:"d20b5917",1393:"1c108252",1403:"435419d9",1405:"d48bc518",1415:"7bf11a82",1422:"4a1bdea8",1464:"5f52d1bb",1488:"e5359f25",1531:"35801cdb",1567:"7b32f11c",1638:"51b96a91",1711:"4db33fd7",1712:"a48fa673",1741:"d8ba1cf4",1749:"d76eb5ff",1787:"1d0ee935",1790:"e125de81",1800:"01362d11",1845:"d75b837f",1874:"353c470e",1921:"dd9a3e1b",1947:"5a7bdd86",1983:"94d598eb",2048:"98e29072",2056:"0e26adbb",2064:"b1198612",2065:"d2d87d53",2078:"ab4f59b2",2087:"d59cfa39",2111:"24f57e35",2134:"3c68727c",2154:"4810acc9",2155:"54851612",2206:"04a5730e",2216:"22204a20",2227:"06b04483",2269:"fd8f8f16",2310:"68681345",2363:"b746103c",2369:"a9bc5aa8",2370:"99814294",2382:"9ecf4cef",2488:"e73880c4",2505:"8ad14b3a",2523:"4b1e782e",2542:"21bf32a6",2576:"97f1b5cd",2651:"d6273192",2659:"a4086cb4",2670:"1518daaf",2708:"a9326e04",2718:"60207401",2719:"e427baf5",2737:"755afef7",2761:"ff191d63",2889:"2b204c5c",2965:"6757514d",2967:"f98c3402",2979:"4a2113b8",3038:"a92d762a",3049:"db7681d3",3050:"b9da20c3",3126:"b7b6486b",3140:"9d83efe7",3207:"c29ad051",3220:"f4e1eb64",3237:"cd2eb16a",3246:"03eb6f95",3311:"8fc47125",3332:"f0b4b736",3345:"1f02ddfd",3352:"73840524",3398:"3558de0e",3428:"225bd274",3431:"c369fc6b",3559:"013e8d5f",3597:"e4593452",3627:"f0cc5a4a",3631:"8080bd51",3645:"deb23e80",3678:"c7c435a7",3683:"7bc52722",3708:"e3cd9629",3709:"c4799ce7",3718:"50300ce7",3801:"93ef644a",3838:"e03c83d5",3881:"e2b95b6d",3908:"cb8a935e",4020:"f1af4b15",4021:"b0663828",4032:"cd55147a",4041:"cbaabbb2",4064:"f1db1b36",4069:"21839983",4173:"5c64803d",4174:"d6739651",4204:"c353ca3c",4274:"f321993d",4278:"388a6439",4336:"a9b84dd9",4378:"aad1c0a7",4405:"0667831a",4425:"350498d6",4447:"0f0e0ddb",4467:"fdd26404",4468:"edc9e00b",4514:"9380c455",4557:"10fcd01c",4560:"b6420f3c",4571:"9e71a449",4578:"f0f448c1",4582:"1edc0c86",4597:"58378872",4603:"4b1a69f7",4616:"360ac698",4643:"1f4adb21",4644:"e41a823a",4665:"f1ccfaa7",4717:"9b87fed2",4753:"28eceb2c",4770:"ed89ea97",4785:"8934558c",4888:"22dab72e",4910:"17d7a05a",4946:"823611f3",4990:"9568ee44",4992:"8d23b6de",4998:"5d129fa8",5e3:"661bdefe",5024:"9d77f730",5095:"c191f61c",5105:"e131b876",5124:"b95d06c9",5180:"3447f7c0",5185:"ecea1136",5239:"f89c6678",5266:"69d0050b",5324:"3ad4af8d",5348:"a353176c",5381:"5aafde02",5512:"921fd6f0",5520:"9f0b914e",5548:"b1fee80f",5557:"dc5f94ed",5637:"ca51737e",5656:"b5913255",5685:"f4d485b7",5688:"8e6fddad",5722:"723206a6",5732:"45060b17",5737:"1308435f",5783:"b8457f89",5786:"e20caff8",5787:"8c8282f6",5804:"bd5520cd",5820:"b4f65098",5834:"8d0eeb03",5835:"46379345",5843:"7cf64a56",5966:"29650cd6",5981:"4da81902",6075:"a488cc3d",6080:"651580dc",6084:"bf90a0d3",6101:"75f8b08f",6119:"38840acb",6124:"737d8a8c",6155:"1f2354d6",6166:"40eb9f57",6184:"01e05ac2",6250:"49d25d5f",6273:"63241f51",6284:"b0649046",6377:"f5eb4570",6397:"efe90783",6412:"47ae253b",6418:"66f99f5a",6465:"20f72335",6491:"e08268f4",6580:"d3413c83",6583:"9911236d",6587:"99727228",6606:"ea8efb53",6641:"1b1cc604",6651:"42064187",6683:"4a766a4d",6694:"20e5bf8d",6696:"4f0c2a38",6711:"b42da8cd",6731:"db4081d7",6746:"a0cc84f9",6751:"80209ba1",6840:"34dce987",6843:"db7f50ae",6849:"392cabc8",6871:"671693e0",6893:"fb2e34fb",6900:"6541bc80",6927:"6f57f850",6954:"39c13a8a",6956:"31e2f7bd",6963:"b6e23bb2",6966:"e87e13ef",6971:"ca8c7782",6996:"f5087739",7019:"5e5fa5fc",7071:"afa5a8be",7098:"7b3b2f2f",7119:"b4b4b5be",7162:"ae254b36",7198:"8083cb50",7218:"6b0a10b1",7252:"d92e37c0",7297:"38adef22",7361:"6ef64c37",7375:"8279ac63",7393:"7e92f5e8",7399:"e3bb505f",7447:"2ff0a141",7456:"1205a734",7467:"88d2e4ae",7570:"9c13449b",7600:"1ac75160",7606:"b9c1de1b",7609:"4c93f012",7621:"1aa60827",7625:"d47f8b24",7690:"73328b36",7691:"67e3afba",7757:"aeb78aeb",7760:"f2db7b74",7801:"0e3fe62a",7806:"3d6d53a2",7893:"10843699",7918:"0ce223b6",7919:"cf0648ef",7920:"64dbd86f",7925:"8e8753df",7957:"ce6561ac",8011:"18bf5d44",8202:"a77c0ec1",8209:"87d54b2b",8235:"d299d342",8253:"793aa540",8278:"d391d3d6",8311:"778cb220",8410:"ae4f1fc2",8443:"a07d66a7",8461:"c5729171",8490:"37d27148",8491:"9bb75992",8494:"0e99e90a",8584:"f4e1eb05",8652:"1920fc89",8666:"537a8728",8709:"5c17069d",8727:"076df8d4",8764:"73e6dbd7",8799:"c0a94bde",8810:"cd3dfa6e",8820:"5fed82ea",8862:"b4acdf17",8871:"88ac6cf9",8877:"2e699234",8879:"a682b7a1",8914:"ea2c71f7",9172:"8f374c1c",9184:"c904a7b8",9197:"6dc9c340",9219:"c81eea10",9291:"af2b16e5",9293:"3dd6db3c",9331:"d7a998f3",9357:"cda771bf",9368:"413824df",9370:"ccd6bfc6",9385:"3e54da02",9395:"3259293f",9408:"b474d2bd",9460:"c762fb1c",9461:"bf7de94a",9514:"26e8b616",9531:"680f2cfb",9549:"b8c39294",9571:"6cca1b93",9594:"8681af58",9604:"7bc8622c",9627:"d77b0af9",9633:"8521d623",9655:"6a9901b0",9667:"0262adb4",9681:"5dda0e12",9751:"bd615ea9",9780:"8ff5a2f0",9800:"e4ee2eee",9802:"a2d7edf9",9839:"ed7883d7",9910:"e30b42bc",9964:"25af1c42",9971:"bcdcdf42"}[e]+".js",r.miniCssF=e=>{},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,b)=>Object.prototype.hasOwnProperty.call(e,b),f={},d="arktype.io:",r.l=(e,b,a,c)=>{if(f[e])f[e].push(b);else{var t,o;if(void 0!==a)for(var n=document.getElementsByTagName("script"),i=0;i{t.onerror=t.onload=null,clearTimeout(s);var d=f[e];if(delete f[e],t.parentNode&&t.parentNode.removeChild(t),d&&d.forEach((e=>e(a))),b)return b(a)},s=setTimeout(l.bind(null,void 0,{type:"timeout",target:t}),12e4);t.onerror=l.bind(null,t.onerror),t.onload=l.bind(null,t.onload),o&&document.head.appendChild(t)}},r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.p="/",r.gca=function(e){return e={17896441:"7918",52828006:"2370",62542541:"6250",70865799:"3708",78815324:"7920",92662164:"4770","218a10b7":"3","661942b6":"15",c1566c80:"33","935f2afb":"53","64b0bc0b":"173","20bbe3a4":"215",d08a5cd9:"253","0a7973dc":"267",a0f38637:"279",a15d4918:"295",b21dc314:"308","39fabe63":"309",b207f374:"343","4bc2b917":"344","6b600ad8":"352","4c51d941":"397",a7d4f0a4:"400","66d34ef6":"408","9b8bb8a5":"440","261d4567":"504",c9cdb2cd:"508",c40baa2c:"513","446de14b":"570","664634ec":"582","6a98dd43":"589",f2fd9995:"610","3f475d74":"663",cc78971e:"709","9cf30a74":"711","7f741c26":"712","54a2e480":"863","6f3866ae":"874",e8871c82:"996","4d0232ca":"1011","56ebe7ce":"1052","04e96f40":"1066",ccfb1236:"1079","37b029e4":"1113","712be200":"1144",d41cdbd4:"1211",e2461dfd:"1228",e0823295:"1268",dc9876d0:"1269",b24ac1a1:"1272","90a8d724":"1370",ccac430f:"1384","95dbee80":"1386",e7930c82:"1393","632d73df":"1403","36a3925a":"1405",b51773d7:"1415",c897f273:"1422","402d9ac3":"1464",f3accd90:"1488","02c148a9":"1531","3e74f845":"1567","50afdaae":"1638",a66fa827:"1711",c6782734:"1712","64a3c6e9":"1741","3c576763":"1749",e87af240:"1787","95ee4656":"1790","9ec264b0":"1800","79bbd73f":"1845",e593da58:"1874",e1c5356f:"1921","8a580bbd":"1947",d4983bd7:"1983","1ebef08a":"2048",dfc31940:"2056","77b85fcc":"2064","3ca54c20":"2065","44ad23ca":"2078","44abb010":"2087",fa5b3c64:"2111","17c9add8":"2134","04ca6b23":"2154","25c35c86":"2155","337a97bf":"2206","00cf5318":"2216","4fc4d3de":"2227","90c008eb":"2269","2d805ff0":"2310",b559d85e:"2363",a6052a4b:"2369","15c910ba":"2382",ed2f6e2d:"2488",aa2edfac:"2505","412337c1":"2542",ed32b608:"2576","0be3f0b3":"2651","201eb429":"2659","9b5b2f56":"2670","7b812af0":"2708","7db05580":"2718","3cd667ef":"2719",e59dc82a:"2737",d20ea9cb:"2761","49fb3aca":"2889","886330fc":"2965","83d426d9":"2967","9939f002":"2979","9021a768":"3038","12bb9ce5":"3049","51a477b6":"3050","7b5196a1":"3126","9d12f58b":"3140",c96b1a52:"3207",d9e6bfd2:"3220","1df93b7f":"3237","11b4899c":"3246","699e8c65":"3311","693c4f31":"3332","0a1349f1":"3345",afb4c8d0:"3352",bf9eb72b:"3398",e34113ea:"3428","52f9fd70":"3431","114efe75":"3559","6d2bdafa":"3597","456f8f16":"3627",d64ec25b:"3631","6543d709":"3645",dda49074:"3678","90f9de61":"3683",f981804c:"3709","0f59f13c":"3718","71aeac4f":"3801","83647aeb":"3838","9b8157dc":"3881","71bbc623":"3908",b0266a2e:"4020",f5450a53:"4021",a8d7e975:"4032",f4ab0997:"4041",d939c4cf:"4064",cc0af677:"4069","4edc808e":"4173","0efbc173":"4174","720b32b8":"4204",a8443108:"4274","74013e48":"4278","60f4de08":"4336","33fa3649":"4378",af2e9fab:"4405",c82ee514:"4425","8fb3568e":"4447",cc8f130c:"4467",b527fae2:"4468","17a90253":"4514","506c0445":"4557",e53c2488:"4560","954d46d2":"4571",fca6815f:"4578","598efede":"4582","339d3c17":"4597","4f719b32":"4603","819b7bff":"4616","0a61f398":"4643","288a554d":"4644","0493d4c1":"4665",c9964daf:"4717","6b6373f3":"4753","7544a8d8":"4785","01a43ec3":"4888","3a4716de":"4910","85d86f40":"4946","0a39420a":"4990","0976b861":"4992",f4d4ef5a:"4998","489af003":"5000",c96bd749:"5024","139f3ccb":"5095",d8893250:"5105","10bb0f04":"5124","422620c1":"5180","717abbec":"5185",bf95da2e:"5239","80a2bf09":"5266","574c3876":"5324",bc5f4b18:"5348","893c3ed1":"5381","8e36631c":"5512","4f91d1fa":"5520",cb67f2be:"5548","47b88856":"5557","629b5b90":"5637",af55ed38:"5656",b45a700f:"5685","3c1eb414":"5688","6b349b64":"5722",d8bba269:"5732","8417b59e":"5737",ea0f6b3f:"5783",c3541e9e:"5786","12140a58":"5787","77ef4de7":"5804","4edc9ce5":"5820","2378f488":"5834",d34d80a4:"5835",e48be19d:"5843",d043b015:"5966",a1b4c482:"5981","119c85c3":"6075","59058b9c":"6080","4a6ff42c":"6084","0d0d98a4":"6101",eb3ac9bb:"6119",de63dc90:"6124","7b1099f0":"6155","28b74367":"6166",ea18a43c:"6184","2bea6d8f":"6284",db25c6b2:"6377","7955d848":"6397",c3aabb3b:"6412","05dfa499":"6418",f56e57b8:"6465",c7123966:"6491","26c0ba22":"6580","66ab3f82":"6583","9a9123fd":"6587",b3f033ae:"6606",dc29efe7:"6641",f6abc386:"6651",e9636bdb:"6683","1cd1dcad":"6694",fa1e6577:"6696",e9e96877:"6711","9d30d1b5":"6731","8122d123":"6746","3da5c09b":"6751","5f7bc296":"6840","6309a6fc":"6843",f4577cf2:"6849","816edea5":"6871",ed756b6e:"6893",c1789402:"6900","35c73967":"6927","431f3670":"6954","10ae884d":"6956","3ea57330":"6963",c7722782:"6966","4c239821":"6971",f042813e:"6996","1915fe21":"7019",c00cc6b2:"7071",e17acbb0:"7098","612311ec":"7119","1602d5a7":"7162","193ee87b":"7198",f7d9de65:"7218",e535037a:"7252","79d70776":"7297",cd758b8d:"7361","5c45db8c":"7375","84389d4b":"7393","6bb186f5":"7399","7cdde229":"7447",e655abbb:"7456",def5e568:"7467","861ccb4a":"7570","2461ffa2":"7600","07cf2946":"7606","54746c5d":"7609",dbd74e1e:"7621","412eae58":"7625",c62ebc34:"7690",ef2d7b11:"7691","704654aa":"7757",cb0719ba:"7760",ef111452:"7801",f0d09dc7:"7806",eb697851:"7893","3a7be745":"7919",de14bdb8:"7925",fa190965:"7957",d78396ad:"8011","29e92f5e":"8202",bfd22999:"8209",df4b4745:"8235","0f77207c":"8253","8b6844fb":"8278","91c230ff":"8410",a6750165:"8443","3bd62677":"8461","8565c7f1":"8490","6fdaf75b":"8491",ac907d5b:"8494",b4d00006:"8584","13e267d5":"8652","336b3993":"8666","0bd12973":"8709","82b3c1af":"8727","9250bde8":"8764","845e825f":"8799","3437bd2a":"8810","859a2b4a":"8820",b3ff9d4c:"8862",f5cf1540:"8871",ca783dc8:"8877",f2d81eea:"8879",b7eb6f82:"8914",c1d314a1:"9172","5179419d":"9184","55fbe152":"9197","990740a9":"9219","7106c5f4":"9291","3c3913a6":"9293","8ebd8584":"9331",ae6a1a09:"9357",b8be6a81:"9368","14af8986":"9370",ff4199e5:"9385",f90a1385:"9395",d804be0b:"9408",ec95bee0:"9460","1ed0e172":"9461","1be78505":"9514",f8cd29e9:"9531","336ac60a":"9549",b7645ba4:"9571","7caf366c":"9594","5a806f6c":"9604",d3ad1999:"9627",e7d10b2a:"9633","4d157327":"9655",e8bf6104:"9667",e6d2a166:"9681","094d205f":"9751","0dbc098c":"9780",fb9b701d:"9800","6a5e2130":"9802","869384d8":"9839","210bc92c":"9910","91ed0e08":"9964",f77690a0:"9971"}[e]||e,r.p+r.u(e)},(()=>{var e={1303:0,532:0};r.f.j=(b,a)=>{var f=r.o(e,b)?e[b]:void 0;if(0!==f)if(f)a.push(f[2]);else if(/^(1303|532)$/.test(b))e[b]=0;else{var d=new Promise(((a,d)=>f=e[b]=[a,d]));a.push(f[2]=d);var c=r.p+r.u(b),t=new Error;r.l(c,(a=>{if(r.o(e,b)&&(0!==(f=e[b])&&(e[b]=void 0),f)){var d=a&&("load"===a.type?"missing":a.type),c=a&&a.target&&a.target.src;t.message="Loading chunk "+b+" failed.\n("+d+": "+c+")",t.name="ChunkLoadError",t.type=d,t.request=c,f[1](t)}}),"chunk-"+b,b)}},r.O.j=b=>0===e[b];var b=(b,a)=>{var f,d,[c,t,o]=a,n=0;if(c.some((b=>0!==e[b]))){for(f in t)r.o(t,f)&&(r.m[f]=t[f]);if(o)var i=o(r)}for(b&&b(a);n - +
- + \ No newline at end of file diff --git a/docs/1.0.19-alpha/api/ark/index.html b/docs/1.0.19-alpha/api/ark/index.html index a598d184a3..82ef613ed3 100644 --- a/docs/1.0.19-alpha/api/ark/index.html +++ b/docs/1.0.19-alpha/api/ark/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.19-alpha

ark

text​

ark: Space<PrecompiledDefaults>
- + \ No newline at end of file diff --git a/docs/1.0.19-alpha/api/arkscope/index.html b/docs/1.0.19-alpha/api/arkscope/index.html index ec697e463c..40974880e1 100644 --- a/docs/1.0.19-alpha/api/arkscope/index.html +++ b/docs/1.0.19-alpha/api/arkscope/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.19-alpha

arkScope

text​

arkScope: import("./scope.js").Scope<
[
{
any: any
bigint: bigint
boolean: boolean
false: false
never: never
null: null
number: number
object: object
string: string
symbol: symbol
true: true
unknown: unknown
void: void
undefined: undefined
Function: (...args: any[]) => unknown
Date: Date
Error: Error
Map: Map<unknown, unknown>
RegExp: RegExp
Set: Set<unknown>
WeakMap: WeakMap<object, unknown>
WeakSet: WeakSet<object>
Promise: Promise<unknown>
alpha: string
alphanumeric: string
lowercase: string
uppercase: string
creditCard: string
email: string
uuid: string
parsedNumber: (In: string) => number
parsedInteger: (In: string) => number
parsedDate: (In: string) => Date
semver: string
json: (In: string) => unknown
integer: number
},
{},
false
]
>
- + \ No newline at end of file diff --git a/docs/1.0.19-alpha/api/arrayof/index.html b/docs/1.0.19-alpha/api/arrayof/index.html index 5be4bd9b62..c91433e2b0 100644 --- a/docs/1.0.19-alpha/api/arrayof/index.html +++ b/docs/1.0.19-alpha/api/arrayof/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.19-alpha

arrayOf

operator​

string​

  • "T[]"
  • const numberArray = type("number[]")

tuple​

  • [T, "[]"]
  • const tupleArray = type(["number", "[]"])

helper​

  • arrayOf(T)
  • const helperArray = arrayOf("number")
- + \ No newline at end of file diff --git a/docs/1.0.19-alpha/api/index.html b/docs/1.0.19-alpha/api/index.html index da1e3aeeff..c1a16a2b7d 100644 --- a/docs/1.0.19-alpha/api/index.html +++ b/docs/1.0.19-alpha/api/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.19-alpha

API

ArkType supports many of TypeScript's built-in types and operators, as well as some new ones dedicated exclusively to runtime validation. In fact, we got a little ahead of ourselves and built a ton of cool features, but we're still working on getting caught up syntax and API docs. Keep an eye out for more in the next couple weeks ⛵

In the meantime, check out the examples here and use the type hints you get to learn how you can customize your types and scopes. If you want to explore some of the more advanced features, take a look at our unit tests or ask us on Discord if your functionality is supported. If not, create a GitHub issue so we can prioritize it!

- + \ No newline at end of file diff --git a/docs/1.0.19-alpha/api/infer/index.html b/docs/1.0.19-alpha/api/infer/index.html index 97d425922f..0df2268736 100644 --- a/docs/1.0.19-alpha/api/infer/index.html +++ b/docs/1.0.19-alpha/api/infer/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.19-alpha

Infer

text​

export type Infer<t> = {
[as]?: t
}
- + \ No newline at end of file diff --git a/docs/1.0.19-alpha/api/instanceof/index.html b/docs/1.0.19-alpha/api/instanceof/index.html index 250ce31660..03897813b4 100644 --- a/docs/1.0.19-alpha/api/instanceof/index.html +++ b/docs/1.0.19-alpha/api/instanceof/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.19-alpha

instanceOf

operator​

tuple​

  • ["instanceOf", T]
  • const tupleInstanceOf = type(["instanceOf", Date])

helper​

  • instanceOf(T)
  • const helperInstanceOf = instanceOf(Date)
- + \ No newline at end of file diff --git a/docs/1.0.19-alpha/api/intersection/index.html b/docs/1.0.19-alpha/api/intersection/index.html index a98072036b..1e3ba6c3b5 100644 --- a/docs/1.0.19-alpha/api/intersection/index.html +++ b/docs/1.0.19-alpha/api/intersection/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.19-alpha

intersection

operator​

string​

  • "L&R"
  • const intersection = type("/@arktype.io$/ & email")

tuple​

  • [L, "&", R]
  • const tupleIntersection = type(["/@arktype.io$/", "&", "email"])

helper​

  • intersection(L,R)
  • const helperIntersection = intersection("/@arktype.io$/","email")
- + \ No newline at end of file diff --git a/docs/1.0.19-alpha/api/jsobjectsscope/index.html b/docs/1.0.19-alpha/api/jsobjectsscope/index.html index 90232445f8..3fe236c380 100644 --- a/docs/1.0.19-alpha/api/jsobjectsscope/index.html +++ b/docs/1.0.19-alpha/api/jsobjectsscope/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.19-alpha

jsObjectsScope

text​

NameTypeDescription
Function (...args: any[]) => unknown
Date Date
Error Error
Map Map<unknown, unknown>
RegExp RegExp
Set Set<unknown>
WeakMap WeakMap<object, unknown>
WeakSet WeakSet<object>
Promise Promise<unknown>
- + \ No newline at end of file diff --git a/docs/1.0.19-alpha/api/keyof/index.html b/docs/1.0.19-alpha/api/keyof/index.html index 603083b15a..ac4729faa0 100644 --- a/docs/1.0.19-alpha/api/keyof/index.html +++ b/docs/1.0.19-alpha/api/keyof/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.19-alpha

keyOf

operator​

tuple​

  • "["keyOf", T]"
  • const tupleKeyOf = type(["keyOf", {a:"string"}])

helper​

  • keyOf(T)
  • const helperKeyOf = keyOf({a:"string"})
- + \ No newline at end of file diff --git a/docs/1.0.19-alpha/api/keywords/index.html b/docs/1.0.19-alpha/api/keywords/index.html index e599f7e2bf..5db894401d 100644 --- a/docs/1.0.19-alpha/api/keywords/index.html +++ b/docs/1.0.19-alpha/api/keywords/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.19-alpha

Keywords

jsObjectsScope​

NameTypeDescription
Function (...args: any[]) => unknown
Date Date
Error Error
Map Map<unknown, unknown>
RegExp RegExp
Set Set<unknown>
WeakMap WeakMap<object, unknown>
WeakSet WeakSet<object>
Promise Promise<unknown>

tsKeywordsScope​

NameTypeDescription
any anyany
bigint biginta bigint
boolean booleana boolean
false falsefalse
never nevernever
null nullnull
number numbera number
object objectan object
string stringa string
symbol symbola symbol
true truetrue
unknown unknownunknown
void voidvoid
undefined undefinedundefined

validationScope​

NameTypeDescription
alpha stringonly letters
alphanumeric stringonly letters and digits
lowercase stringonly lowercase letters
uppercase stringonly uppercase letters
creditCard stringa valid credit card number
email stringa valid email
uuid stringa valid UUID
parsedNumber (In: string) => numbera well-formed numeric string
parsedInteger (In: string) => numbera well-formed integer string
parsedDate (In: string) => Datea valid date
semver stringa valid semantic version
json (In: string) => unknowna JSON-parsable string
integer numberan integer
- + \ No newline at end of file diff --git a/docs/1.0.19-alpha/api/morph/index.html b/docs/1.0.19-alpha/api/morph/index.html index de6c6021b3..99428223bf 100644 --- a/docs/1.0.19-alpha/api/morph/index.html +++ b/docs/1.0.19-alpha/api/morph/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.19-alpha

morph

operator​

tuple​

  • [inputType, "|>", (data) => output]
  • const tupleMorph = type( ["string", "|>" , (data) => `morphed ${data}`])

helper​

  • morph(inputType, (data) => output)
  • const helperMorph = morph("string", (data) => `morphed ${data}`)
- + \ No newline at end of file diff --git a/docs/1.0.19-alpha/api/narrow/index.html b/docs/1.0.19-alpha/api/narrow/index.html index cca75b5128..644f65d1ae 100644 --- a/docs/1.0.19-alpha/api/narrow/index.html +++ b/docs/1.0.19-alpha/api/narrow/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.19-alpha

narrow

operator​

tuple​

  • ["type", "=>" , condition]
  • const narrow = type( ["number", "=>" , (n) => n % 2 === 0])

example​

  •      const isEven = (x: unknown): x is number => x % 2 === 0
- + \ No newline at end of file diff --git a/docs/1.0.19-alpha/api/operators/index.html b/docs/1.0.19-alpha/api/operators/index.html index 16961c4890..062f6ac416 100644 --- a/docs/1.0.19-alpha/api/operators/index.html +++ b/docs/1.0.19-alpha/api/operators/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.19-alpha

Operators

Operating Table​

operatorstringtuplehelper
arrayOf"T[]"[T, "[]"]arrayOf(T)
instanceOf["instanceOf", T]instanceOf(T)
&"L&R"[L, "&", R]intersection(L,R)
keyOf"["keyOf", T]"keyOf(T)
|>[inputType, "|>", (data) => output]morph(inputType, (data) => output)
=>["type", "=>" , condition]
|"L|R"[L, "|" , R]union(L,R)
===["===", T]valueOf(T)
:["type", ":", config]
bound"N<S<N", with comparators restricted to < or <=
%"N%D", where "N" is a number and "D" is a non-zero integer
node["node", nodeDefinition]type.from(nodeDefinition)
- + \ No newline at end of file diff --git a/docs/1.0.19-alpha/api/parseconfigtuple/index.html b/docs/1.0.19-alpha/api/parseconfigtuple/index.html index 4e62145f28..98e2a7cdf5 100644 --- a/docs/1.0.19-alpha/api/parseconfigtuple/index.html +++ b/docs/1.0.19-alpha/api/parseconfigtuple/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.19-alpha

parseConfigTuple

operator​

tuple​

  • ["type", ":", config]
- + \ No newline at end of file diff --git a/docs/1.0.19-alpha/api/problem/index.html b/docs/1.0.19-alpha/api/problem/index.html index 77ae45c9bf..e71d72ba4d 100644 --- a/docs/1.0.19-alpha/api/problem/index.html +++ b/docs/1.0.19-alpha/api/problem/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.19-alpha

Problem

text​

export declare class Problem<code extends ProblemCode = ProblemCode> {
code: code
path: Path
private data
private source
private writers
parts?: Problem[]
constructor(
code: code,
path: Path,
data: ProblemData<code>,
source: ProblemSource<code>,
writers: ProblemWriters<code>
)
toString(): string
get message(): string
get reason(): string
get mustBe(): string
}
- + \ No newline at end of file diff --git a/docs/1.0.19-alpha/api/problems/index.html b/docs/1.0.19-alpha/api/problems/index.html index 6baaa48886..9d6016b6a2 100644 --- a/docs/1.0.19-alpha/api/problems/index.html +++ b/docs/1.0.19-alpha/api/problems/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.19-alpha

Problems

text​

Problems: new (state: TraversalState) => Problems
export type Problems = arraySubclassToReadonly<ProblemArray>;
- + \ No newline at end of file diff --git a/docs/1.0.19-alpha/api/resolvednode/index.html b/docs/1.0.19-alpha/api/resolvednode/index.html index d728106840..98453a15f1 100644 --- a/docs/1.0.19-alpha/api/resolvednode/index.html +++ b/docs/1.0.19-alpha/api/resolvednode/index.html @@ -7,13 +7,13 @@ - +
- + \ No newline at end of file diff --git a/docs/1.0.19-alpha/api/scope/index.html b/docs/1.0.19-alpha/api/scope/index.html index d1ec56b8c7..e8c62cf293 100644 --- a/docs/1.0.19-alpha/api/scope/index.html +++ b/docs/1.0.19-alpha/api/scope/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.19-alpha

scope

text​

scope: ScopeParser

hide_table_of_contents: true​

Scope

text​

export declare class Scope<context extends ScopeContext = any> {
#private
aliases: Dict
name: string
config: ScopeConfig
parseCache: FreezingCache<Node>
constructor(aliases: Dict, opts?: ScopeOptions)
getAnonymousQualifiedName(base: AnonymousTypeName): QualifiedTypeName
addAnonymousTypeReference(referencedType: Type, ctx: ParseContext): Node
get infer(): exportsOf<context>
compile(): Space<exportsOf<context>>
addParsedReferenceIfResolvable(
name: name<context>,
ctx: ParseContext
): boolean
resolve(name: name<context>): Type
resolveNode(node: Node): ResolvedNode
resolveTypeNode(node: Node): TypeNode
expressions: Expressions<resolutions<context>>
intersection: import("./expressions.js").BinaryExpressionParser<
resolutions<context>,
"&"
>
union: import("./expressions.js").BinaryExpressionParser<
resolutions<context>,
"|"
>
arrayOf: import("./expressions.js").UnaryExpressionParser<
resolutions<context>,
"[]"
>
keyOf: import("./expressions.js").UnaryExpressionParser<
resolutions<context>,
"keyof"
>
valueOf: import("./expressions.js").UnvalidatedExpressionParser<
resolutions<context>,
"==="
>
instanceOf: import("./expressions.js").UnvalidatedExpressionParser<
resolutions<context>,
"instanceof"
>
narrow: import("./expressions.js").FunctionalExpressionParser<
resolutions<context>,
"=>"
>
morph: import("./expressions.js").FunctionalExpressionParser<
resolutions<context>,
"|>"
>
type: TypeParser<resolutions<context>>
isResolvable(name: string): unknown
}
- + \ No newline at end of file diff --git a/docs/1.0.19-alpha/api/space/index.html b/docs/1.0.19-alpha/api/space/index.html index f530ca3ded..c3275c1ab1 100644 --- a/docs/1.0.19-alpha/api/space/index.html +++ b/docs/1.0.19-alpha/api/space/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.19-alpha

Space

text​

export type Space<exports = Dict> = {
[k in keyof exports]: Type<exports[k]>
}
- + \ No newline at end of file diff --git a/docs/1.0.19-alpha/api/tskeywordsscope/index.html b/docs/1.0.19-alpha/api/tskeywordsscope/index.html index b68aea9cf4..684e3515b9 100644 --- a/docs/1.0.19-alpha/api/tskeywordsscope/index.html +++ b/docs/1.0.19-alpha/api/tskeywordsscope/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.19-alpha

tsKeywordsScope

keywords​

  • keywords: {"any": "any", "bigint": "a bigint", "boolean": "a boolean", "false": "false", "never": "never", "null": "null", "number": "a number", "object": "an object", "string": "a string", "symbol": "a symbol", "true": "true", "unknown": "unknown", "void": "void", "undefined": "undefined"}

text​

NameTypeDescription
any anyany
bigint biginta bigint
boolean booleana boolean
false falsefalse
never nevernever
null nullnull
number numbera number
object objectan object
string stringa string
symbol symbola symbol
true truetrue
unknown unknownunknown
void voidvoid
undefined undefinedundefined
- + \ No newline at end of file diff --git a/docs/1.0.19-alpha/api/type/index.html b/docs/1.0.19-alpha/api/type/index.html index 5565a57e3d..fcc7971833 100644 --- a/docs/1.0.19-alpha/api/type/index.html +++ b/docs/1.0.19-alpha/api/type/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.19-alpha

type

text​

type: TypeParser<PrecompiledDefaults>

hide_table_of_contents: true​

Type

text​

export type Type<t = unknown> = defer<Checker<t> & TypeRoot<t>>
- + \ No newline at end of file diff --git a/docs/1.0.19-alpha/api/union/index.html b/docs/1.0.19-alpha/api/union/index.html index d14fd83aa6..256d54cba6 100644 --- a/docs/1.0.19-alpha/api/union/index.html +++ b/docs/1.0.19-alpha/api/union/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.19-alpha

union

operator​

string​

  • "L|R"
  • const union = type("string|number")

tuple​

  • [L, "|" , R]
  • const tupleUnion = type(["string", "|", "number"])

helper​

  • union(L,R)
  • const helperUnion = union("string", "number")
- + \ No newline at end of file diff --git a/docs/1.0.19-alpha/api/validatebound/index.html b/docs/1.0.19-alpha/api/validatebound/index.html index fc2a1cafe3..f7b47d6dc7 100644 --- a/docs/1.0.19-alpha/api/validatebound/index.html +++ b/docs/1.0.19-alpha/api/validatebound/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.19-alpha

validateBound

operator​

tableRow​

VariableDescription
Nnumber literal
Ssized data (a number, string or array)
<Comparator (one of <, <=, ==, >=, >)

description​

  • Bound operators allow data to be bounded in the format "S<N", or as a Range: "N<S<N", with comparators restricted to < or <=

string​

  • "N<S<N", with comparators restricted to < or <=
  • const range = type("2<=number<5")
  • const bound = type("string[]==5")
- + \ No newline at end of file diff --git a/docs/1.0.19-alpha/api/validatedivisor/index.html b/docs/1.0.19-alpha/api/validatedivisor/index.html index 598ee23ec5..c47f9d2251 100644 --- a/docs/1.0.19-alpha/api/validatedivisor/index.html +++ b/docs/1.0.19-alpha/api/validatedivisor/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.19-alpha

validateDivisor

operator​

string​

  • "N%D", where "N" is a number and "D" is a non-zero integer
- + \ No newline at end of file diff --git a/docs/1.0.19-alpha/api/validationscope/index.html b/docs/1.0.19-alpha/api/validationscope/index.html index abe4158037..e7d055900b 100644 --- a/docs/1.0.19-alpha/api/validationscope/index.html +++ b/docs/1.0.19-alpha/api/validationscope/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.19-alpha

validationScope

keywords​

  • keywords: { "alpha": "only letters", "alphanumeric": "only letters and digits", "lowercase": "only lowercase letters", "uppercase": "only uppercase letters", "creditCard": "a valid credit card number", "email": "a valid email", "uuid": "a valid UUID", "parsedNumber": "a well-formed numeric string", "parsedInteger": "a well-formed integer string", "parsedDate": "a valid date", "semver": "a valid semantic version", "json": "a JSON-parsable string", "integer": "an integer"}

text​

NameTypeDescription
alpha stringonly letters
alphanumeric stringonly letters and digits
lowercase stringonly lowercase letters
uppercase stringonly uppercase letters
creditCard stringa valid credit card number
email stringa valid email
uuid stringa valid UUID
parsedNumber (In: string) => numbera well-formed numeric string
parsedInteger (In: string) => numbera well-formed integer string
parsedDate (In: string) => Datea valid date
semver stringa valid semantic version
json (In: string) => unknowna JSON-parsable string
integer numberan integer
- + \ No newline at end of file diff --git a/docs/1.0.19-alpha/api/valueof/index.html b/docs/1.0.19-alpha/api/valueof/index.html index 6cd511aa0e..28c02ab63f 100644 --- a/docs/1.0.19-alpha/api/valueof/index.html +++ b/docs/1.0.19-alpha/api/valueof/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.19-alpha

valueOf

operator​

tuple​

  • ["===", T]
  • const tupleValueOf = type(["valueOf", {a:"string"}])

helper​

  • valueOf(T)
  • const helperValueOf = valueOf({a:"string"})
- + \ No newline at end of file diff --git a/docs/1.0.19-alpha/index.html b/docs/1.0.19-alpha/index.html index 19e175fde1..8887e64d88 100644 --- a/docs/1.0.19-alpha/index.html +++ b/docs/1.0.19-alpha/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.19-alpha

Getting Started

Install 📦12KB gzipped, 0 dependencies​

Npm Icon npm install arktype(or whatever package manager you prefer)

Our types are tested in strict-mode with TypeScript versions 4.8, 4.9, and 5.0.

Our APIs have mostly stabilized, but details may still change during the alpha/beta stages of our 1.0 release. If you have suggestions that may require a breaking change, now is the time to let us know! ⛵

Your first type​

- + \ No newline at end of file diff --git a/docs/1.0.19-alpha/scopes/index.html b/docs/1.0.19-alpha/scopes/index.html index e07b207265..510803f9a8 100644 --- a/docs/1.0.19-alpha/scopes/index.html +++ b/docs/1.0.19-alpha/scopes/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.19-alpha

Scopes

- + \ No newline at end of file diff --git a/docs/1.0.20-alpha/api/ark/index.html b/docs/1.0.20-alpha/api/ark/index.html index 6e0feaf25e..7f38e6271e 100644 --- a/docs/1.0.20-alpha/api/ark/index.html +++ b/docs/1.0.20-alpha/api/ark/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.20-alpha

ark

text​

ark: Space<PrecompiledDefaults>
- + \ No newline at end of file diff --git a/docs/1.0.20-alpha/api/arkscope/index.html b/docs/1.0.20-alpha/api/arkscope/index.html index 6aa31e2c04..f4c0f786f5 100644 --- a/docs/1.0.20-alpha/api/arkscope/index.html +++ b/docs/1.0.20-alpha/api/arkscope/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.20-alpha

arkScope

text​

arkScope: import("./scope.js").Scope<
[
{
any: any
bigint: bigint
boolean: boolean
false: false
never: never
null: null
number: number
object: object
string: string
symbol: symbol
true: true
unknown: unknown
void: void
undefined: undefined
Function: (...args: any[]) => unknown
Date: Date
Error: Error
Map: Map<unknown, unknown>
RegExp: RegExp
Set: Set<unknown>
WeakMap: WeakMap<object, unknown>
WeakSet: WeakSet<object>
Promise: Promise<unknown>
alpha: string
alphanumeric: string
lowercase: string
uppercase: string
creditCard: string
email: string
uuid: string
parsedNumber: (In: string) => number
parsedInteger: (In: string) => number
parsedDate: (In: string) => Date
semver: string
json: (In: string) => unknown
integer: number
},
{},
false
]
>
- + \ No newline at end of file diff --git a/docs/1.0.20-alpha/api/arrayof/index.html b/docs/1.0.20-alpha/api/arrayof/index.html index 7bf311f3bc..1ff0fccdf5 100644 --- a/docs/1.0.20-alpha/api/arrayof/index.html +++ b/docs/1.0.20-alpha/api/arrayof/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.20-alpha

arrayOf

operator​

string​

  • "T[]"
  • const numberArray = type("number[]")

tuple​

  • [T, "[]"]
  • const tupleArray = type(["number", "[]"])

helper​

  • arrayOf(T)
  • const helperArray = arrayOf("number")
- + \ No newline at end of file diff --git a/docs/1.0.20-alpha/api/index.html b/docs/1.0.20-alpha/api/index.html index dbd331c802..f4526f29a7 100644 --- a/docs/1.0.20-alpha/api/index.html +++ b/docs/1.0.20-alpha/api/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.20-alpha

API

ArkType supports many of TypeScript's built-in types and operators, as well as some new ones dedicated exclusively to runtime validation. In fact, we got a little ahead of ourselves and built a ton of cool features, but we're still working on getting caught up syntax and API docs. Keep an eye out for more in the next couple weeks ⛵

In the meantime, check out the examples here and use the type hints you get to learn how you can customize your types and scopes. If you want to explore some of the more advanced features, take a look at our unit tests or ask us on Discord if your functionality is supported. If not, create a GitHub issue so we can prioritize it!

- + \ No newline at end of file diff --git a/docs/1.0.20-alpha/api/infer/index.html b/docs/1.0.20-alpha/api/infer/index.html index face563c66..dfe80a7ffc 100644 --- a/docs/1.0.20-alpha/api/infer/index.html +++ b/docs/1.0.20-alpha/api/infer/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.20-alpha

Infer

text​

export type Infer<t> = {
[as]?: t
}
- + \ No newline at end of file diff --git a/docs/1.0.20-alpha/api/instanceof/index.html b/docs/1.0.20-alpha/api/instanceof/index.html index 6ea93c4f29..f2dd228695 100644 --- a/docs/1.0.20-alpha/api/instanceof/index.html +++ b/docs/1.0.20-alpha/api/instanceof/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.20-alpha

instanceOf

operator​

tuple​

  • ["instanceOf", T]
  • const tupleInstanceOf = type(["instanceOf", Date])

helper​

  • instanceOf(T)
  • const helperInstanceOf = instanceOf(Date)
- + \ No newline at end of file diff --git a/docs/1.0.20-alpha/api/intersection/index.html b/docs/1.0.20-alpha/api/intersection/index.html index c718a48211..fbabde0f42 100644 --- a/docs/1.0.20-alpha/api/intersection/index.html +++ b/docs/1.0.20-alpha/api/intersection/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.20-alpha

intersection

operator​

string​

  • "L&R"
  • const intersection = type("/@arktype.io$/ & email")

tuple​

  • [L, "&", R]
  • const tupleIntersection = type(["/@arktype.io$/", "&", "email"])

helper​

  • intersection(L,R)
  • const helperIntersection = intersection("/@arktype.io$/","email")
- + \ No newline at end of file diff --git a/docs/1.0.20-alpha/api/jsobjectsscope/index.html b/docs/1.0.20-alpha/api/jsobjectsscope/index.html index dd3280abaa..4f4f634d3f 100644 --- a/docs/1.0.20-alpha/api/jsobjectsscope/index.html +++ b/docs/1.0.20-alpha/api/jsobjectsscope/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.20-alpha

jsObjectsScope

text​

NameTypeDescription
Function (...args: any[]) => unknown
Date Date
Error Error
Map Map<unknown, unknown>
RegExp RegExp
Set Set<unknown>
WeakMap WeakMap<object, unknown>
WeakSet WeakSet<object>
Promise Promise<unknown>
- + \ No newline at end of file diff --git a/docs/1.0.20-alpha/api/keyof/index.html b/docs/1.0.20-alpha/api/keyof/index.html index b6cb84d35b..446d8b4912 100644 --- a/docs/1.0.20-alpha/api/keyof/index.html +++ b/docs/1.0.20-alpha/api/keyof/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.20-alpha

keyOf

operator​

tuple​

  • "["keyOf", T]"
  • const tupleKeyOf = type(["keyOf", {a:"string"}])

helper​

  • keyOf(T)
  • const helperKeyOf = keyOf({a:"string"})
- + \ No newline at end of file diff --git a/docs/1.0.20-alpha/api/keywords/index.html b/docs/1.0.20-alpha/api/keywords/index.html index 9753f81299..0a00ba3a14 100644 --- a/docs/1.0.20-alpha/api/keywords/index.html +++ b/docs/1.0.20-alpha/api/keywords/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.20-alpha

Keywords

jsObjectsScope​

NameTypeDescription
Function (...args: any[]) => unknown
Date Date
Error Error
Map Map<unknown, unknown>
RegExp RegExp
Set Set<unknown>
WeakMap WeakMap<object, unknown>
WeakSet WeakSet<object>
Promise Promise<unknown>

tsKeywordsScope​

NameTypeDescription
any anyany
bigint biginta bigint
boolean booleana boolean
false falsefalse
never nevernever
null nullnull
number numbera number
object objectan object
string stringa string
symbol symbola symbol
true truetrue
unknown unknownunknown
void voidvoid
undefined undefinedundefined

validationScope​

NameTypeDescription
alpha stringonly letters
alphanumeric stringonly letters and digits
lowercase stringonly lowercase letters
uppercase stringonly uppercase letters
creditCard stringa valid credit card number
email stringa valid email
uuid stringa valid UUID
parsedNumber (In: string) => numbera well-formed numeric string
parsedInteger (In: string) => numbera well-formed integer string
parsedDate (In: string) => Datea valid date
semver stringa valid semantic version
json (In: string) => unknowna JSON-parsable string
integer numberan integer
- + \ No newline at end of file diff --git a/docs/1.0.20-alpha/api/morph/index.html b/docs/1.0.20-alpha/api/morph/index.html index 81680a7b43..7b3759e5bd 100644 --- a/docs/1.0.20-alpha/api/morph/index.html +++ b/docs/1.0.20-alpha/api/morph/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.20-alpha

morph

operator​

tuple​

  • [inputType, "|>", (data) => output]
  • const tupleMorph = type( ["string", "|>" , (data) => `morphed ${data}`])

helper​

  • morph(inputType, (data) => output)
  • const helperMorph = morph("string", (data) => `morphed ${data}`)
- + \ No newline at end of file diff --git a/docs/1.0.20-alpha/api/narrow/index.html b/docs/1.0.20-alpha/api/narrow/index.html index 045405b72c..26b9dbcbc4 100644 --- a/docs/1.0.20-alpha/api/narrow/index.html +++ b/docs/1.0.20-alpha/api/narrow/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.20-alpha

narrow

operator​

tuple​

  • ["type", "=>" , condition]
  • const narrow = type( ["number", "=>" , (n) => n % 2 === 0])

example​

  •      const isEven = (x: unknown): x is number => x % 2 === 0
- + \ No newline at end of file diff --git a/docs/1.0.20-alpha/api/operators/index.html b/docs/1.0.20-alpha/api/operators/index.html index c86bbb7cae..70d0cf452c 100644 --- a/docs/1.0.20-alpha/api/operators/index.html +++ b/docs/1.0.20-alpha/api/operators/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.20-alpha

Operators

Operating Table​

operatorstringtuplehelper
arrayOf"T[]"[T, "[]"]arrayOf(T)
instanceOf["instanceOf", T]instanceOf(T)
&"L&R"[L, "&", R]intersection(L,R)
keyOf"["keyOf", T]"keyOf(T)
|>[inputType, "|>", (data) => output]morph(inputType, (data) => output)
=>["type", "=>" , condition]
|"L|R"[L, "|" , R]union(L,R)
===["===", T]valueOf(T)
:["type", ":", config]
bound"N<S<N", with comparators restricted to < or <=
%"N%D", where "N" is a number and "D" is a non-zero integer
node["node", nodeDefinition]type.from(nodeDefinition)
- + \ No newline at end of file diff --git a/docs/1.0.20-alpha/api/parseconfigtuple/index.html b/docs/1.0.20-alpha/api/parseconfigtuple/index.html index 7e69d345f3..98c3ad72b8 100644 --- a/docs/1.0.20-alpha/api/parseconfigtuple/index.html +++ b/docs/1.0.20-alpha/api/parseconfigtuple/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.20-alpha

parseConfigTuple

operator​

tuple​

  • ["type", ":", config]
- + \ No newline at end of file diff --git a/docs/1.0.20-alpha/api/problem/index.html b/docs/1.0.20-alpha/api/problem/index.html index d5f540cdce..8ffe3ab9f5 100644 --- a/docs/1.0.20-alpha/api/problem/index.html +++ b/docs/1.0.20-alpha/api/problem/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.20-alpha

Problem

text​

export declare class Problem<code extends ProblemCode = ProblemCode> {
code: code
path: Path
private data
private source
private writers
parts?: Problem[]
constructor(
code: code,
path: Path,
data: ProblemData<code>,
source: ProblemSource<code>,
writers: ProblemWriters<code>
)
toString(): string
get message(): string
get reason(): string
get mustBe(): string
}
- + \ No newline at end of file diff --git a/docs/1.0.20-alpha/api/problems/index.html b/docs/1.0.20-alpha/api/problems/index.html index f63c7e8221..3e700a5336 100644 --- a/docs/1.0.20-alpha/api/problems/index.html +++ b/docs/1.0.20-alpha/api/problems/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.20-alpha

Problems

text​

Problems: new (state: TraversalState) => Problems
export type Problems = arraySubclassToReadonly<ProblemArray>;
- + \ No newline at end of file diff --git a/docs/1.0.20-alpha/api/resolvednode/index.html b/docs/1.0.20-alpha/api/resolvednode/index.html index 135567118c..627a4e8249 100644 --- a/docs/1.0.20-alpha/api/resolvednode/index.html +++ b/docs/1.0.20-alpha/api/resolvednode/index.html @@ -7,13 +7,13 @@ - +
- + \ No newline at end of file diff --git a/docs/1.0.20-alpha/api/scope/index.html b/docs/1.0.20-alpha/api/scope/index.html index 2af0cdcaf2..a845d691e5 100644 --- a/docs/1.0.20-alpha/api/scope/index.html +++ b/docs/1.0.20-alpha/api/scope/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.20-alpha

scope

text​

scope: ScopeParser

hide_table_of_contents: true​

Scope

text​

export declare class Scope<context extends ScopeContext = any> {
#private
aliases: Dict
name: string
config: ScopeConfig
parseCache: FreezingCache<Node>
constructor(aliases: Dict, opts?: ScopeOptions)
getAnonymousQualifiedName(base: AnonymousTypeName): QualifiedTypeName
addAnonymousTypeReference(referencedType: Type, ctx: ParseContext): Node
get infer(): exportsOf<context>
compile(): Space<exportsOf<context>>
addParsedReferenceIfResolvable(
name: name<context>,
ctx: ParseContext
): boolean
resolve(name: name<context>): Type
resolveNode(node: Node): ResolvedNode
resolveTypeNode(node: Node): TypeNode
expressions: Expressions<resolutions<context>>
intersection: import("./expressions.js").BinaryExpressionParser<
resolutions<context>,
"&"
>
union: import("./expressions.js").BinaryExpressionParser<
resolutions<context>,
"|"
>
arrayOf: import("./expressions.js").UnaryExpressionParser<
resolutions<context>,
"[]"
>
keyOf: import("./expressions.js").UnaryExpressionParser<
resolutions<context>,
"keyof"
>
valueOf: import("./expressions.js").UnvalidatedExpressionParser<
resolutions<context>,
"==="
>
instanceOf: import("./expressions.js").UnvalidatedExpressionParser<
resolutions<context>,
"instanceof"
>
narrow: import("./expressions.js").FunctionalExpressionParser<
resolutions<context>,
"=>"
>
morph: import("./expressions.js").FunctionalExpressionParser<
resolutions<context>,
"|>"
>
type: TypeParser<resolutions<context>>
isResolvable(name: string): unknown
}
- + \ No newline at end of file diff --git a/docs/1.0.20-alpha/api/space/index.html b/docs/1.0.20-alpha/api/space/index.html index aa139f898a..530390a527 100644 --- a/docs/1.0.20-alpha/api/space/index.html +++ b/docs/1.0.20-alpha/api/space/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.20-alpha

Space

text​

export type Space<exports = Dict> = {
[k in keyof exports]: Type<exports[k]>
}
- + \ No newline at end of file diff --git a/docs/1.0.20-alpha/api/tskeywordsscope/index.html b/docs/1.0.20-alpha/api/tskeywordsscope/index.html index abc96df86b..e6a35f5b30 100644 --- a/docs/1.0.20-alpha/api/tskeywordsscope/index.html +++ b/docs/1.0.20-alpha/api/tskeywordsscope/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.20-alpha

tsKeywordsScope

keywords​

  • keywords: {"any": "any", "bigint": "a bigint", "boolean": "a boolean", "false": "false", "never": "never", "null": "null", "number": "a number", "object": "an object", "string": "a string", "symbol": "a symbol", "true": "true", "unknown": "unknown", "void": "void", "undefined": "undefined"}

text​

NameTypeDescription
any anyany
bigint biginta bigint
boolean booleana boolean
false falsefalse
never nevernever
null nullnull
number numbera number
object objectan object
string stringa string
symbol symbola symbol
true truetrue
unknown unknownunknown
void voidvoid
undefined undefinedundefined
- + \ No newline at end of file diff --git a/docs/1.0.20-alpha/api/type/index.html b/docs/1.0.20-alpha/api/type/index.html index f66875c2f7..83f3d339bb 100644 --- a/docs/1.0.20-alpha/api/type/index.html +++ b/docs/1.0.20-alpha/api/type/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.20-alpha

type

text​

type: TypeParser<PrecompiledDefaults>

hide_table_of_contents: true​

Type

text​

export type Type<t = unknown> = defer<Checker<t> & TypeRoot<t>>
- + \ No newline at end of file diff --git a/docs/1.0.20-alpha/api/union/index.html b/docs/1.0.20-alpha/api/union/index.html index 56b27a18e6..a159ae069c 100644 --- a/docs/1.0.20-alpha/api/union/index.html +++ b/docs/1.0.20-alpha/api/union/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.20-alpha

union

operator​

string​

  • "L|R"
  • const union = type("string|number")

tuple​

  • [L, "|" , R]
  • const tupleUnion = type(["string", "|", "number"])

helper​

  • union(L,R)
  • const helperUnion = union("string", "number")
- + \ No newline at end of file diff --git a/docs/1.0.20-alpha/api/validatebound/index.html b/docs/1.0.20-alpha/api/validatebound/index.html index 360354a17a..2c90b8ffc7 100644 --- a/docs/1.0.20-alpha/api/validatebound/index.html +++ b/docs/1.0.20-alpha/api/validatebound/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.20-alpha

validateBound

operator​

tableRow​

VariableDescription
Nnumber literal
Ssized data (a number, string or array)
<Comparator (one of <, <=, ==, >=, >)

description​

  • Bound operators allow data to be bounded in the format "S<N", or as a Range: "N<S<N", with comparators restricted to < or <=

string​

  • "N<S<N", with comparators restricted to < or <=
  • const range = type("2<=number<5")
  • const bound = type("string[]==5")
- + \ No newline at end of file diff --git a/docs/1.0.20-alpha/api/validatedivisor/index.html b/docs/1.0.20-alpha/api/validatedivisor/index.html index 87b7da7260..50d3b41434 100644 --- a/docs/1.0.20-alpha/api/validatedivisor/index.html +++ b/docs/1.0.20-alpha/api/validatedivisor/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.20-alpha

validateDivisor

operator​

string​

  • "N%D", where "N" is a number and "D" is a non-zero integer
- + \ No newline at end of file diff --git a/docs/1.0.20-alpha/api/validationscope/index.html b/docs/1.0.20-alpha/api/validationscope/index.html index 51ecb6dba1..cf559b0c25 100644 --- a/docs/1.0.20-alpha/api/validationscope/index.html +++ b/docs/1.0.20-alpha/api/validationscope/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.20-alpha

validationScope

keywords​

  • keywords: { "alpha": "only letters", "alphanumeric": "only letters and digits", "lowercase": "only lowercase letters", "uppercase": "only uppercase letters", "creditCard": "a valid credit card number", "email": "a valid email", "uuid": "a valid UUID", "parsedNumber": "a well-formed numeric string", "parsedInteger": "a well-formed integer string", "parsedDate": "a valid date", "semver": "a valid semantic version", "json": "a JSON-parsable string", "integer": "an integer"}

text​

NameTypeDescription
alpha stringonly letters
alphanumeric stringonly letters and digits
lowercase stringonly lowercase letters
uppercase stringonly uppercase letters
creditCard stringa valid credit card number
email stringa valid email
uuid stringa valid UUID
parsedNumber (In: string) => numbera well-formed numeric string
parsedInteger (In: string) => numbera well-formed integer string
parsedDate (In: string) => Datea valid date
semver stringa valid semantic version
json (In: string) => unknowna JSON-parsable string
integer numberan integer
- + \ No newline at end of file diff --git a/docs/1.0.20-alpha/api/valueof/index.html b/docs/1.0.20-alpha/api/valueof/index.html index bc502b8101..1d5fd59b61 100644 --- a/docs/1.0.20-alpha/api/valueof/index.html +++ b/docs/1.0.20-alpha/api/valueof/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.20-alpha

valueOf

operator​

tuple​

  • ["===", T]
  • const tupleValueOf = type(["valueOf", {a:"string"}])

helper​

  • valueOf(T)
  • const helperValueOf = valueOf({a:"string"})
- + \ No newline at end of file diff --git a/docs/1.0.20-alpha/index.html b/docs/1.0.20-alpha/index.html index 3e19f4adce..7c1f927a2c 100644 --- a/docs/1.0.20-alpha/index.html +++ b/docs/1.0.20-alpha/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.20-alpha

Getting Started

Install 📦12KB gzipped, 0 dependencies​

Npm Icon npm install arktype(or whatever package manager you prefer)

Our types are tested in strict-mode with TypeScript versions 4.8, 4.9, and 5.0.

Our APIs have mostly stabilized, but details may still change during the alpha/beta stages of our 1.0 release. If you have suggestions that may require a breaking change, now is the time to let us know! ⛵

Your first type​

- + \ No newline at end of file diff --git a/docs/1.0.20-alpha/scopes/index.html b/docs/1.0.20-alpha/scopes/index.html index 71ac368349..838d03ce88 100644 --- a/docs/1.0.20-alpha/scopes/index.html +++ b/docs/1.0.20-alpha/scopes/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.20-alpha

Scopes

- + \ No newline at end of file diff --git a/docs/1.0.21-alpha/api/ark/index.html b/docs/1.0.21-alpha/api/ark/index.html index b0c2bf917a..cad883647c 100644 --- a/docs/1.0.21-alpha/api/ark/index.html +++ b/docs/1.0.21-alpha/api/ark/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.21-alpha

ark

text​

ark: Space<PrecompiledDefaults>
- + \ No newline at end of file diff --git a/docs/1.0.21-alpha/api/arkscope/index.html b/docs/1.0.21-alpha/api/arkscope/index.html index 1f757e3d82..cc5ffe38ad 100644 --- a/docs/1.0.21-alpha/api/arkscope/index.html +++ b/docs/1.0.21-alpha/api/arkscope/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.21-alpha

arkScope

text​

arkScope: import("./scope.js").Scope<
[
{
any: any
bigint: bigint
boolean: boolean
false: false
never: never
null: null
number: number
object: object
string: string
symbol: symbol
true: true
unknown: unknown
void: void
undefined: undefined
Function: (...args: any[]) => unknown
Date: Date
Error: Error
Map: Map<unknown, unknown>
RegExp: RegExp
Set: Set<unknown>
WeakMap: WeakMap<object, unknown>
WeakSet: WeakSet<object>
Promise: Promise<unknown>
alpha: string
alphanumeric: string
lowercase: string
uppercase: string
creditCard: string
email: string
uuid: string
parsedNumber: (In: string) => number
parsedInteger: (In: string) => number
parsedDate: (In: string) => Date
semver: string
json: (In: string) => unknown
integer: number
},
{},
false
]
>
- + \ No newline at end of file diff --git a/docs/1.0.21-alpha/api/arrayof/index.html b/docs/1.0.21-alpha/api/arrayof/index.html index a8677ea22c..da999dc7cf 100644 --- a/docs/1.0.21-alpha/api/arrayof/index.html +++ b/docs/1.0.21-alpha/api/arrayof/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.21-alpha

arrayOf

operator​

string​

  • "T[]"
  • const numberArray = type("number[]")

tuple​

  • [T, "[]"]
  • const tupleArray = type(["number", "[]"])

helper​

  • arrayOf(T)
  • const helperArray = arrayOf("number")
- + \ No newline at end of file diff --git a/docs/1.0.21-alpha/api/index.html b/docs/1.0.21-alpha/api/index.html index 9f41f8cf61..61d6b1dc0a 100644 --- a/docs/1.0.21-alpha/api/index.html +++ b/docs/1.0.21-alpha/api/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.21-alpha

API

ArkType supports many of TypeScript's built-in types and operators, as well as some new ones dedicated exclusively to runtime validation. In fact, we got a little ahead of ourselves and built a ton of cool features, but we're still working on getting caught up syntax and API docs. Keep an eye out for more in the next couple weeks ⛵

In the meantime, check out the examples here and use the type hints you get to learn how you can customize your types and scopes. If you want to explore some of the more advanced features, take a look at our unit tests or ask us on Discord if your functionality is supported. If not, create a GitHub issue so we can prioritize it!

- + \ No newline at end of file diff --git a/docs/1.0.21-alpha/api/infer/index.html b/docs/1.0.21-alpha/api/infer/index.html index 087cb69ee3..7ab254763b 100644 --- a/docs/1.0.21-alpha/api/infer/index.html +++ b/docs/1.0.21-alpha/api/infer/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.21-alpha

Infer

text​

export type Infer<t> = {
[as]?: t
}
- + \ No newline at end of file diff --git a/docs/1.0.21-alpha/api/instanceof/index.html b/docs/1.0.21-alpha/api/instanceof/index.html index e8736973bd..00ce1c4748 100644 --- a/docs/1.0.21-alpha/api/instanceof/index.html +++ b/docs/1.0.21-alpha/api/instanceof/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.21-alpha

instanceOf

operator​

tuple​

  • ["instanceOf", T]
  • const tupleInstanceOf = type(["instanceOf", Date])

helper​

  • instanceOf(T)
  • const helperInstanceOf = instanceOf(Date)
- + \ No newline at end of file diff --git a/docs/1.0.21-alpha/api/intersection/index.html b/docs/1.0.21-alpha/api/intersection/index.html index 8c988bf1cf..72ea9ca1ce 100644 --- a/docs/1.0.21-alpha/api/intersection/index.html +++ b/docs/1.0.21-alpha/api/intersection/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.21-alpha

intersection

operator​

string​

  • "L&R"
  • const intersection = type("/@arktype.io$/ & email")

tuple​

  • [L, "&", R]
  • const tupleIntersection = type(["/@arktype.io$/", "&", "email"])

helper​

  • intersection(L,R)
  • const helperIntersection = intersection("/@arktype.io$/","email")
- + \ No newline at end of file diff --git a/docs/1.0.21-alpha/api/jsobjectsscope/index.html b/docs/1.0.21-alpha/api/jsobjectsscope/index.html index e278921430..bad598e3df 100644 --- a/docs/1.0.21-alpha/api/jsobjectsscope/index.html +++ b/docs/1.0.21-alpha/api/jsobjectsscope/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.21-alpha

jsObjectsScope

text​

NameTypeDescription
Function (...args: any[]) => unknown
Date Date
Error Error
Map Map<unknown, unknown>
RegExp RegExp
Set Set<unknown>
WeakMap WeakMap<object, unknown>
WeakSet WeakSet<object>
Promise Promise<unknown>
- + \ No newline at end of file diff --git a/docs/1.0.21-alpha/api/keyof/index.html b/docs/1.0.21-alpha/api/keyof/index.html index 7826b4c6ed..b95ac14dcc 100644 --- a/docs/1.0.21-alpha/api/keyof/index.html +++ b/docs/1.0.21-alpha/api/keyof/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.21-alpha

keyOf

operator​

tuple​

  • "["keyOf", T]"
  • const tupleKeyOf = type(["keyOf", {a:"string"}])

helper​

  • keyOf(T)
  • const helperKeyOf = keyOf({a:"string"})
- + \ No newline at end of file diff --git a/docs/1.0.21-alpha/api/keywords/index.html b/docs/1.0.21-alpha/api/keywords/index.html index cf673c0b76..23e8dbde6c 100644 --- a/docs/1.0.21-alpha/api/keywords/index.html +++ b/docs/1.0.21-alpha/api/keywords/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.21-alpha

Keywords

jsObjectsScope​

NameTypeDescription
Function (...args: any[]) => unknown
Date Date
Error Error
Map Map<unknown, unknown>
RegExp RegExp
Set Set<unknown>
WeakMap WeakMap<object, unknown>
WeakSet WeakSet<object>
Promise Promise<unknown>

tsKeywordsScope​

NameTypeDescription
any anyany
bigint biginta bigint
boolean booleana boolean
false falsefalse
never nevernever
null nullnull
number numbera number
object objectan object
string stringa string
symbol symbola symbol
true truetrue
unknown unknownunknown
void voidvoid
undefined undefinedundefined

validationScope​

NameTypeDescription
alpha stringonly letters
alphanumeric stringonly letters and digits
lowercase stringonly lowercase letters
uppercase stringonly uppercase letters
creditCard stringa valid credit card number
email stringa valid email
uuid stringa valid UUID
parsedNumber (In: string) => numbera well-formed numeric string
parsedInteger (In: string) => numbera well-formed integer string
parsedDate (In: string) => Datea valid date
semver stringa valid semantic version
json (In: string) => unknowna JSON-parsable string
integer numberan integer
- + \ No newline at end of file diff --git a/docs/1.0.21-alpha/api/morph/index.html b/docs/1.0.21-alpha/api/morph/index.html index 25aa8f6369..c855bb595a 100644 --- a/docs/1.0.21-alpha/api/morph/index.html +++ b/docs/1.0.21-alpha/api/morph/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.21-alpha

morph

operator​

tuple​

  • [inputType, "|>", (data) => output]
  • const tupleMorph = type( ["string", "|>" , (data) => `morphed ${data}`])

helper​

  • morph(inputType, (data) => output)
  • const helperMorph = morph("string", (data) => `morphed ${data}`)
- + \ No newline at end of file diff --git a/docs/1.0.21-alpha/api/narrow/index.html b/docs/1.0.21-alpha/api/narrow/index.html index 0eaa944f27..4162c60a7e 100644 --- a/docs/1.0.21-alpha/api/narrow/index.html +++ b/docs/1.0.21-alpha/api/narrow/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.21-alpha

narrow

operator​

tuple​

  • ["type", "=>" , condition]
  • const narrow = type( ["number", "=>" , (n) => n % 2 === 0])

example​

  •      const isEven = (x: unknown): x is number => x % 2 === 0
- + \ No newline at end of file diff --git a/docs/1.0.21-alpha/api/operators/index.html b/docs/1.0.21-alpha/api/operators/index.html index 905eba29ab..7c7d00f2e7 100644 --- a/docs/1.0.21-alpha/api/operators/index.html +++ b/docs/1.0.21-alpha/api/operators/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.21-alpha

Operators

Operating Table​

operatorstringtuplehelper
arrayOf"T[]"[T, "[]"]arrayOf(T)
instanceOf["instanceOf", T]instanceOf(T)
&"L&R"[L, "&", R]intersection(L,R)
keyOf"["keyOf", T]"keyOf(T)
|>[inputType, "|>", (data) => output]morph(inputType, (data) => output)
=>["type", "=>" , condition]
|"L|R"[L, "|" , R]union(L,R)
===["===", T]valueOf(T)
:["type", ":", config]
bound"N<S<N", with comparators restricted to < or <=
%"N%D", where "N" is a number and "D" is a non-zero integer
node["node", nodeDefinition]type.from(nodeDefinition)
- + \ No newline at end of file diff --git a/docs/1.0.21-alpha/api/parseconfigtuple/index.html b/docs/1.0.21-alpha/api/parseconfigtuple/index.html index b2a4efd282..21aedae9bf 100644 --- a/docs/1.0.21-alpha/api/parseconfigtuple/index.html +++ b/docs/1.0.21-alpha/api/parseconfigtuple/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.21-alpha

parseConfigTuple

operator​

tuple​

  • ["type", ":", config]
- + \ No newline at end of file diff --git a/docs/1.0.21-alpha/api/problem/index.html b/docs/1.0.21-alpha/api/problem/index.html index 9908acfb1f..ce0dddee2f 100644 --- a/docs/1.0.21-alpha/api/problem/index.html +++ b/docs/1.0.21-alpha/api/problem/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.21-alpha

Problem

text​

export declare class Problem<code extends ProblemCode = ProblemCode> {
code: code
path: Path
private data
private source
private writers
parts?: Problem[]
constructor(
code: code,
path: Path,
data: ProblemData<code>,
source: ProblemSource<code>,
writers: ProblemWriters<code>
)
toString(): string
get message(): string
get reason(): string
get mustBe(): string
}
- + \ No newline at end of file diff --git a/docs/1.0.21-alpha/api/problems/index.html b/docs/1.0.21-alpha/api/problems/index.html index 84ba50cd67..8f6172c599 100644 --- a/docs/1.0.21-alpha/api/problems/index.html +++ b/docs/1.0.21-alpha/api/problems/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.21-alpha

Problems

text​

Problems: new (state: TraversalState) => Problems
export type Problems = arraySubclassToReadonly<ProblemArray>;
- + \ No newline at end of file diff --git a/docs/1.0.21-alpha/api/resolvednode/index.html b/docs/1.0.21-alpha/api/resolvednode/index.html index fe4e32caf1..27b7c8e961 100644 --- a/docs/1.0.21-alpha/api/resolvednode/index.html +++ b/docs/1.0.21-alpha/api/resolvednode/index.html @@ -7,13 +7,13 @@ - +
- + \ No newline at end of file diff --git a/docs/1.0.21-alpha/api/scope/index.html b/docs/1.0.21-alpha/api/scope/index.html index 8312132a23..2f1db7ad17 100644 --- a/docs/1.0.21-alpha/api/scope/index.html +++ b/docs/1.0.21-alpha/api/scope/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.21-alpha

scope

text​

scope: ScopeParser

hide_table_of_contents: true​

Scope

text​

export declare class Scope<context extends ScopeContext = any> {
#private
aliases: Dict
name: string
config: ScopeConfig
parseCache: FreezingCache<Node>
constructor(aliases: Dict, opts?: ScopeOptions)
getAnonymousQualifiedName(base: AnonymousTypeName): QualifiedTypeName
addAnonymousTypeReference(referencedType: Type, ctx: ParseContext): Node
get infer(): exportsOf<context>
compile(): Space<exportsOf<context>>
addParsedReferenceIfResolvable(
name: name<context>,
ctx: ParseContext
): boolean
resolve(name: name<context>): Type
resolveNode(node: Node): ResolvedNode
resolveTypeNode(node: Node): TypeNode
expressions: Expressions<resolutions<context>>
intersection: import("./expressions.js").BinaryExpressionParser<
resolutions<context>,
"&"
>
union: import("./expressions.js").BinaryExpressionParser<
resolutions<context>,
"|"
>
arrayOf: import("./expressions.js").UnaryExpressionParser<
resolutions<context>,
"[]"
>
keyOf: import("./expressions.js").UnaryExpressionParser<
resolutions<context>,
"keyof"
>
valueOf: import("./expressions.js").UnvalidatedExpressionParser<
resolutions<context>,
"==="
>
instanceOf: import("./expressions.js").UnvalidatedExpressionParser<
resolutions<context>,
"instanceof"
>
narrow: import("./expressions.js").FunctionalExpressionParser<
resolutions<context>,
"=>"
>
morph: import("./expressions.js").FunctionalExpressionParser<
resolutions<context>,
"|>"
>
type: TypeParser<resolutions<context>>
isResolvable(name: string): unknown
}
- + \ No newline at end of file diff --git a/docs/1.0.21-alpha/api/space/index.html b/docs/1.0.21-alpha/api/space/index.html index cf5d6da5b7..d08b833169 100644 --- a/docs/1.0.21-alpha/api/space/index.html +++ b/docs/1.0.21-alpha/api/space/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.21-alpha

Space

text​

export type Space<exports = Dict> = {
[k in keyof exports]: Type<exports[k]>
}
- + \ No newline at end of file diff --git a/docs/1.0.21-alpha/api/tskeywordsscope/index.html b/docs/1.0.21-alpha/api/tskeywordsscope/index.html index 80c843901d..df6ed2bb58 100644 --- a/docs/1.0.21-alpha/api/tskeywordsscope/index.html +++ b/docs/1.0.21-alpha/api/tskeywordsscope/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.21-alpha

tsKeywordsScope

keywords​

  • keywords: {"any": "any", "bigint": "a bigint", "boolean": "a boolean", "false": "false", "never": "never", "null": "null", "number": "a number", "object": "an object", "string": "a string", "symbol": "a symbol", "true": "true", "unknown": "unknown", "void": "void", "undefined": "undefined"}

text​

NameTypeDescription
any anyany
bigint biginta bigint
boolean booleana boolean
false falsefalse
never nevernever
null nullnull
number numbera number
object objectan object
string stringa string
symbol symbola symbol
true truetrue
unknown unknownunknown
void voidvoid
undefined undefinedundefined
- + \ No newline at end of file diff --git a/docs/1.0.21-alpha/api/type/index.html b/docs/1.0.21-alpha/api/type/index.html index 0418175905..97c8a9f29b 100644 --- a/docs/1.0.21-alpha/api/type/index.html +++ b/docs/1.0.21-alpha/api/type/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.21-alpha

type

text​

type: TypeParser<PrecompiledDefaults>

hide_table_of_contents: true​

Type

text​

export type Type<t = unknown> = defer<Checker<t> & TypeRoot<t>>
- + \ No newline at end of file diff --git a/docs/1.0.21-alpha/api/union/index.html b/docs/1.0.21-alpha/api/union/index.html index 03db06f043..820a9061e3 100644 --- a/docs/1.0.21-alpha/api/union/index.html +++ b/docs/1.0.21-alpha/api/union/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.21-alpha

union

operator​

string​

  • "L|R"
  • const union = type("string|number")

tuple​

  • [L, "|" , R]
  • const tupleUnion = type(["string", "|", "number"])

helper​

  • union(L,R)
  • const helperUnion = union("string", "number")
- + \ No newline at end of file diff --git a/docs/1.0.21-alpha/api/validatebound/index.html b/docs/1.0.21-alpha/api/validatebound/index.html index adfc49e1ba..4827113849 100644 --- a/docs/1.0.21-alpha/api/validatebound/index.html +++ b/docs/1.0.21-alpha/api/validatebound/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.21-alpha

validateBound

operator​

tableRow​

VariableDescription
Nnumber literal
Ssized data (a number, string or array)
<Comparator (one of <, <=, ==, >=, >)

description​

  • Bound operators allow data to be bounded in the format "S<N", or as a Range: "N<S<N", with comparators restricted to < or <=

string​

  • "N<S<N", with comparators restricted to < or <=
  • const range = type("2<=number<5")
  • const bound = type("string[]==5")
- + \ No newline at end of file diff --git a/docs/1.0.21-alpha/api/validatedivisor/index.html b/docs/1.0.21-alpha/api/validatedivisor/index.html index 2c888e6c54..94164bc5ab 100644 --- a/docs/1.0.21-alpha/api/validatedivisor/index.html +++ b/docs/1.0.21-alpha/api/validatedivisor/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.21-alpha

validateDivisor

operator​

string​

  • "N%D", where "N" is a number and "D" is a non-zero integer
- + \ No newline at end of file diff --git a/docs/1.0.21-alpha/api/validationscope/index.html b/docs/1.0.21-alpha/api/validationscope/index.html index e6b37b6cfa..3194a97f1f 100644 --- a/docs/1.0.21-alpha/api/validationscope/index.html +++ b/docs/1.0.21-alpha/api/validationscope/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.21-alpha

validationScope

keywords​

  • keywords: { "alpha": "only letters", "alphanumeric": "only letters and digits", "lowercase": "only lowercase letters", "uppercase": "only uppercase letters", "creditCard": "a valid credit card number", "email": "a valid email", "uuid": "a valid UUID", "parsedNumber": "a well-formed numeric string", "parsedInteger": "a well-formed integer string", "parsedDate": "a valid date", "semver": "a valid semantic version", "json": "a JSON-parsable string", "integer": "an integer"}

text​

NameTypeDescription
alpha stringonly letters
alphanumeric stringonly letters and digits
lowercase stringonly lowercase letters
uppercase stringonly uppercase letters
creditCard stringa valid credit card number
email stringa valid email
uuid stringa valid UUID
parsedNumber (In: string) => numbera well-formed numeric string
parsedInteger (In: string) => numbera well-formed integer string
parsedDate (In: string) => Datea valid date
semver stringa valid semantic version
json (In: string) => unknowna JSON-parsable string
integer numberan integer
- + \ No newline at end of file diff --git a/docs/1.0.21-alpha/api/valueof/index.html b/docs/1.0.21-alpha/api/valueof/index.html index 3abe1a1b24..7ab0b8a9cf 100644 --- a/docs/1.0.21-alpha/api/valueof/index.html +++ b/docs/1.0.21-alpha/api/valueof/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.21-alpha

valueOf

operator​

tuple​

  • ["===", T]
  • const tupleValueOf = type(["valueOf", {a:"string"}])

helper​

  • valueOf(T)
  • const helperValueOf = valueOf({a:"string"})
- + \ No newline at end of file diff --git a/docs/1.0.21-alpha/index.html b/docs/1.0.21-alpha/index.html index e561a388dc..695d7949f6 100644 --- a/docs/1.0.21-alpha/index.html +++ b/docs/1.0.21-alpha/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.21-alpha

Getting Started

Install 📦12KB gzipped, 0 dependencies​

Npm Icon npm install arktype(or whatever package manager you prefer)

Our types are tested in strict-mode with TypeScript versions 4.8, 4.9, and 5.0.

Our APIs have mostly stabilized, but details may still change during the alpha/beta stages of our 1.0 release. If you have suggestions that may require a breaking change, now is the time to let us know! ⛵

Your first type​

- + \ No newline at end of file diff --git a/docs/1.0.21-alpha/scopes/index.html b/docs/1.0.21-alpha/scopes/index.html index ca84e40dd5..3db5bea3ae 100644 --- a/docs/1.0.21-alpha/scopes/index.html +++ b/docs/1.0.21-alpha/scopes/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.21-alpha

Scopes

- + \ No newline at end of file diff --git a/docs/1.0.22-alpha/api/ark/index.html b/docs/1.0.22-alpha/api/ark/index.html index 6c6b661720..e487cd7456 100644 --- a/docs/1.0.22-alpha/api/ark/index.html +++ b/docs/1.0.22-alpha/api/ark/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.22-alpha

ark

text​

ark: Space<PrecompiledDefaults>
- + \ No newline at end of file diff --git a/docs/1.0.22-alpha/api/arkscope/index.html b/docs/1.0.22-alpha/api/arkscope/index.html index b0e374e042..5130795bd4 100644 --- a/docs/1.0.22-alpha/api/arkscope/index.html +++ b/docs/1.0.22-alpha/api/arkscope/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.22-alpha

arkScope

text​

arkScope: import("./scope.js").Scope<
[
{
any: any
bigint: bigint
boolean: boolean
false: false
never: never
null: null
number: number
object: object
string: string
symbol: symbol
true: true
unknown: unknown
void: void
undefined: undefined
Function: (...args: any[]) => unknown
Date: Date
Error: Error
Map: Map<unknown, unknown>
RegExp: RegExp
Set: Set<unknown>
WeakMap: WeakMap<object, unknown>
WeakSet: WeakSet<object>
Promise: Promise<unknown>
alpha: string
alphanumeric: string
lowercase: string
uppercase: string
creditCard: string
email: string
uuid: string
parsedNumber: (In: string) => number
parsedInteger: (In: string) => number
parsedDate: (In: string) => Date
semver: string
json: (In: string) => unknown
integer: number
},
{},
false
]
>
- + \ No newline at end of file diff --git a/docs/1.0.22-alpha/api/arrayof/index.html b/docs/1.0.22-alpha/api/arrayof/index.html index b71d2bba02..69ad41c0a8 100644 --- a/docs/1.0.22-alpha/api/arrayof/index.html +++ b/docs/1.0.22-alpha/api/arrayof/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.22-alpha

arrayOf

operator​

string​

  • "T[]"
  • const numberArray = type("number[]")

tuple​

  • [T, "[]"]
  • const tupleArray = type(["number", "[]"])

helper​

  • arrayOf(T)
  • const helperArray = arrayOf("number")
- + \ No newline at end of file diff --git a/docs/1.0.22-alpha/api/index.html b/docs/1.0.22-alpha/api/index.html index f58be50efc..6298f3b15b 100644 --- a/docs/1.0.22-alpha/api/index.html +++ b/docs/1.0.22-alpha/api/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.22-alpha

API

ArkType supports many of TypeScript's built-in types and operators, as well as some new ones dedicated exclusively to runtime validation. In fact, we got a little ahead of ourselves and built a ton of cool features, but we're still working on getting caught up syntax and API docs. Keep an eye out for more in the next couple weeks ⛵

In the meantime, check out the examples here and use the type hints you get to learn how you can customize your types and scopes. If you want to explore some of the more advanced features, take a look at our unit tests or ask us on Discord if your functionality is supported. If not, create a GitHub issue so we can prioritize it!

- + \ No newline at end of file diff --git a/docs/1.0.22-alpha/api/infer/index.html b/docs/1.0.22-alpha/api/infer/index.html index f6b16a4ac0..8fd89632dc 100644 --- a/docs/1.0.22-alpha/api/infer/index.html +++ b/docs/1.0.22-alpha/api/infer/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.22-alpha

Infer

text​

export type Infer<t> = {
[as]?: t
}
- + \ No newline at end of file diff --git a/docs/1.0.22-alpha/api/instanceof/index.html b/docs/1.0.22-alpha/api/instanceof/index.html index bf4189945d..f6084805cd 100644 --- a/docs/1.0.22-alpha/api/instanceof/index.html +++ b/docs/1.0.22-alpha/api/instanceof/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.22-alpha

instanceOf

operator​

tuple​

  • ["instanceOf", T]
  • const tupleInstanceOf = type(["instanceOf", Date])

helper​

  • instanceOf(T)
  • const helperInstanceOf = instanceOf(Date)
- + \ No newline at end of file diff --git a/docs/1.0.22-alpha/api/intersection/index.html b/docs/1.0.22-alpha/api/intersection/index.html index c6a2905023..9f8c53b6ab 100644 --- a/docs/1.0.22-alpha/api/intersection/index.html +++ b/docs/1.0.22-alpha/api/intersection/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.22-alpha

intersection

operator​

string​

  • "L&R"
  • const intersection = type("/@arktype.io$/ & email")

tuple​

  • [L, "&", R]
  • const tupleIntersection = type(["/@arktype.io$/", "&", "email"])

helper​

  • intersection(L,R)
  • const helperIntersection = intersection("/@arktype.io$/","email")
- + \ No newline at end of file diff --git a/docs/1.0.22-alpha/api/jsobjectsscope/index.html b/docs/1.0.22-alpha/api/jsobjectsscope/index.html index 9bddd7d719..381a5af3f8 100644 --- a/docs/1.0.22-alpha/api/jsobjectsscope/index.html +++ b/docs/1.0.22-alpha/api/jsobjectsscope/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.22-alpha

jsObjectsScope

text​

NameTypeDescription
Function (...args: any[]) => unknown
Date Date
Error Error
Map Map<unknown, unknown>
RegExp RegExp
Set Set<unknown>
WeakMap WeakMap<object, unknown>
WeakSet WeakSet<object>
Promise Promise<unknown>
- + \ No newline at end of file diff --git a/docs/1.0.22-alpha/api/keyof/index.html b/docs/1.0.22-alpha/api/keyof/index.html index 2f581437d7..ad67cf4a2b 100644 --- a/docs/1.0.22-alpha/api/keyof/index.html +++ b/docs/1.0.22-alpha/api/keyof/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.22-alpha

keyOf

operator​

tuple​

  • "["keyOf", T]"
  • const tupleKeyOf = type(["keyOf", {a:"string"}])

helper​

  • keyOf(T)
  • const helperKeyOf = keyOf({a:"string"})
- + \ No newline at end of file diff --git a/docs/1.0.22-alpha/api/keywords/index.html b/docs/1.0.22-alpha/api/keywords/index.html index 74a97d4495..c21945ac82 100644 --- a/docs/1.0.22-alpha/api/keywords/index.html +++ b/docs/1.0.22-alpha/api/keywords/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.22-alpha

Keywords

jsObjectsScope​

NameTypeDescription
Function (...args: any[]) => unknown
Date Date
Error Error
Map Map<unknown, unknown>
RegExp RegExp
Set Set<unknown>
WeakMap WeakMap<object, unknown>
WeakSet WeakSet<object>
Promise Promise<unknown>

tsKeywordsScope​

NameTypeDescription
any anyany
bigint biginta bigint
boolean booleana boolean
false falsefalse
never nevernever
null nullnull
number numbera number
object objectan object
string stringa string
symbol symbola symbol
true truetrue
unknown unknownunknown
void voidvoid
undefined undefinedundefined

validationScope​

NameTypeDescription
alpha stringonly letters
alphanumeric stringonly letters and digits
lowercase stringonly lowercase letters
uppercase stringonly uppercase letters
creditCard stringa valid credit card number
email stringa valid email
uuid stringa valid UUID
parsedNumber (In: string) => numbera well-formed numeric string
parsedInteger (In: string) => numbera well-formed integer string
parsedDate (In: string) => Datea valid date
semver stringa valid semantic version
json (In: string) => unknowna JSON-parsable string
integer numberan integer
- + \ No newline at end of file diff --git a/docs/1.0.22-alpha/api/morph/index.html b/docs/1.0.22-alpha/api/morph/index.html index 3e9df8677b..e83fbb6f35 100644 --- a/docs/1.0.22-alpha/api/morph/index.html +++ b/docs/1.0.22-alpha/api/morph/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.22-alpha

morph

operator​

tuple​

  • [inputType, "|>", (data) => output]
  • const tupleMorph = type( ["string", "|>" , (data) => `morphed ${data}`])

helper​

  • morph(inputType, (data) => output)
  • const helperMorph = morph("string", (data) => `morphed ${data}`)
- + \ No newline at end of file diff --git a/docs/1.0.22-alpha/api/narrow/index.html b/docs/1.0.22-alpha/api/narrow/index.html index 5a564dc611..03f75924d6 100644 --- a/docs/1.0.22-alpha/api/narrow/index.html +++ b/docs/1.0.22-alpha/api/narrow/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.22-alpha

narrow

operator​

tuple​

  • ["type", "=>" , condition]
  • const narrow = type( ["number", "=>" , (n) => n % 2 === 0])

example​

  •      const isEven = (x: unknown): x is number => x % 2 === 0
- + \ No newline at end of file diff --git a/docs/1.0.22-alpha/api/operators/index.html b/docs/1.0.22-alpha/api/operators/index.html index c552f1639f..f64a52dfd2 100644 --- a/docs/1.0.22-alpha/api/operators/index.html +++ b/docs/1.0.22-alpha/api/operators/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.22-alpha

Operators

Operating Table​

operatorstringtuplehelper
arrayOf"T[]"[T, "[]"]arrayOf(T)
instanceOf["instanceOf", T]instanceOf(T)
&"L&R"[L, "&", R]intersection(L,R)
keyOf"["keyOf", T]"keyOf(T)
|>[inputType, "|>", (data) => output]morph(inputType, (data) => output)
=>["type", "=>" , condition]
|"L|R"[L, "|" , R]union(L,R)
===["===", T]valueOf(T)
:["type", ":", config]
bound"N<S<N", with comparators restricted to < or <=
%"N%D", where "N" is a number and "D" is a non-zero integer
node["node", nodeDefinition]type.from(nodeDefinition)
- + \ No newline at end of file diff --git a/docs/1.0.22-alpha/api/parseconfigtuple/index.html b/docs/1.0.22-alpha/api/parseconfigtuple/index.html index ee70fc6358..9264af0582 100644 --- a/docs/1.0.22-alpha/api/parseconfigtuple/index.html +++ b/docs/1.0.22-alpha/api/parseconfigtuple/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.22-alpha

parseConfigTuple

operator​

tuple​

  • ["type", ":", config]
- + \ No newline at end of file diff --git a/docs/1.0.22-alpha/api/problem/index.html b/docs/1.0.22-alpha/api/problem/index.html index 5848210f7c..7b61e83c79 100644 --- a/docs/1.0.22-alpha/api/problem/index.html +++ b/docs/1.0.22-alpha/api/problem/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.22-alpha

Problem

text​

export declare class Problem<code extends ProblemCode = ProblemCode> {
code: code
path: Path
private data
private source
private writers
parts?: Problem[]
constructor(
code: code,
path: Path,
data: ProblemData<code>,
source: ProblemSource<code>,
writers: ProblemWriters<code>
)
toString(): string
get message(): string
get reason(): string
get mustBe(): string
}
- + \ No newline at end of file diff --git a/docs/1.0.22-alpha/api/problems/index.html b/docs/1.0.22-alpha/api/problems/index.html index 689215bf99..0581088c3e 100644 --- a/docs/1.0.22-alpha/api/problems/index.html +++ b/docs/1.0.22-alpha/api/problems/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.22-alpha

Problems

text​

Problems: new (state: TraversalState) => Problems
export type Problems = arraySubclassToReadonly<ProblemArray>;
- + \ No newline at end of file diff --git a/docs/1.0.22-alpha/api/resolvednode/index.html b/docs/1.0.22-alpha/api/resolvednode/index.html index 48919ccb6f..77190109f6 100644 --- a/docs/1.0.22-alpha/api/resolvednode/index.html +++ b/docs/1.0.22-alpha/api/resolvednode/index.html @@ -7,13 +7,13 @@ - +
- + \ No newline at end of file diff --git a/docs/1.0.22-alpha/api/scope/index.html b/docs/1.0.22-alpha/api/scope/index.html index 71ef9290d4..e60c237368 100644 --- a/docs/1.0.22-alpha/api/scope/index.html +++ b/docs/1.0.22-alpha/api/scope/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.22-alpha

scope

text​

scope: ScopeParser

hide_table_of_contents: true​

Scope

text​

export declare class Scope<context extends ScopeContext = any> {
#private
aliases: Dict
name: string
config: ScopeConfig
parseCache: FreezingCache<Node>
constructor(aliases: Dict, opts?: ScopeOptions)
getAnonymousQualifiedName(base: AnonymousTypeName): QualifiedTypeName
addAnonymousTypeReference(referencedType: Type, ctx: ParseContext): Node
get infer(): exportsOf<context>
compile(): Space<exportsOf<context>>
addParsedReferenceIfResolvable(
name: name<context>,
ctx: ParseContext
): boolean
resolve(name: name<context>): Type
resolveNode(node: Node): ResolvedNode
resolveTypeNode(node: Node): TypeNode
expressions: Expressions<resolutions<context>>
intersection: import("./expressions.js").BinaryExpressionParser<
resolutions<context>,
"&"
>
union: import("./expressions.js").BinaryExpressionParser<
resolutions<context>,
"|"
>
arrayOf: import("./expressions.js").UnaryExpressionParser<
resolutions<context>,
"[]"
>
keyOf: import("./expressions.js").UnaryExpressionParser<
resolutions<context>,
"keyof"
>
valueOf: import("./expressions.js").UnvalidatedExpressionParser<
resolutions<context>,
"==="
>
instanceOf: import("./expressions.js").UnvalidatedExpressionParser<
resolutions<context>,
"instanceof"
>
narrow: import("./expressions.js").FunctionalExpressionParser<
resolutions<context>,
"=>"
>
morph: import("./expressions.js").FunctionalExpressionParser<
resolutions<context>,
"|>"
>
type: TypeParser<resolutions<context>>
isResolvable(name: string): unknown
}
- + \ No newline at end of file diff --git a/docs/1.0.22-alpha/api/space/index.html b/docs/1.0.22-alpha/api/space/index.html index 485ca6e2b3..7fbe69faf7 100644 --- a/docs/1.0.22-alpha/api/space/index.html +++ b/docs/1.0.22-alpha/api/space/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.22-alpha

Space

text​

export type Space<exports = Dict> = {
[k in keyof exports]: Type<exports[k]>
}
- + \ No newline at end of file diff --git a/docs/1.0.22-alpha/api/tskeywordsscope/index.html b/docs/1.0.22-alpha/api/tskeywordsscope/index.html index 5052334920..ecb5ff2dc8 100644 --- a/docs/1.0.22-alpha/api/tskeywordsscope/index.html +++ b/docs/1.0.22-alpha/api/tskeywordsscope/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.22-alpha

tsKeywordsScope

keywords​

  • keywords: {"any": "any", "bigint": "a bigint", "boolean": "a boolean", "false": "false", "never": "never", "null": "null", "number": "a number", "object": "an object", "string": "a string", "symbol": "a symbol", "true": "true", "unknown": "unknown", "void": "void", "undefined": "undefined"}

text​

NameTypeDescription
any anyany
bigint biginta bigint
boolean booleana boolean
false falsefalse
never nevernever
null nullnull
number numbera number
object objectan object
string stringa string
symbol symbola symbol
true truetrue
unknown unknownunknown
void voidvoid
undefined undefinedundefined
- + \ No newline at end of file diff --git a/docs/1.0.22-alpha/api/type/index.html b/docs/1.0.22-alpha/api/type/index.html index fa8e5f3993..e861867731 100644 --- a/docs/1.0.22-alpha/api/type/index.html +++ b/docs/1.0.22-alpha/api/type/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.22-alpha

type

text​

type: TypeParser<PrecompiledDefaults>

hide_table_of_contents: true​

Type

text​

export type Type<t = unknown> = defer<Checker<t> & TypeRoot<t>>
- + \ No newline at end of file diff --git a/docs/1.0.22-alpha/api/union/index.html b/docs/1.0.22-alpha/api/union/index.html index 84431f1e75..d2d2f85bb5 100644 --- a/docs/1.0.22-alpha/api/union/index.html +++ b/docs/1.0.22-alpha/api/union/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.22-alpha

union

operator​

string​

  • "L|R"
  • const union = type("string|number")

tuple​

  • [L, "|" , R]
  • const tupleUnion = type(["string", "|", "number"])

helper​

  • union(L,R)
  • const helperUnion = union("string", "number")
- + \ No newline at end of file diff --git a/docs/1.0.22-alpha/api/validatebound/index.html b/docs/1.0.22-alpha/api/validatebound/index.html index 672e70c687..23f15eb44a 100644 --- a/docs/1.0.22-alpha/api/validatebound/index.html +++ b/docs/1.0.22-alpha/api/validatebound/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.22-alpha

validateBound

operator​

tableRow​

VariableDescription
Nnumber literal
Ssized data (a number, string or array)
<Comparator (one of <, <=, ==, >=, >)

description​

  • Bound operators allow data to be bounded in the format "S<N", or as a Range: "N<S<N", with comparators restricted to < or <=

string​

  • "N<S<N", with comparators restricted to < or <=
  • const range = type("2<=number<5")
  • const bound = type("string[]==5")
- + \ No newline at end of file diff --git a/docs/1.0.22-alpha/api/validatedivisor/index.html b/docs/1.0.22-alpha/api/validatedivisor/index.html index cadaf94254..8c41b6c7af 100644 --- a/docs/1.0.22-alpha/api/validatedivisor/index.html +++ b/docs/1.0.22-alpha/api/validatedivisor/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.22-alpha

validateDivisor

operator​

string​

  • "N%D", where "N" is a number and "D" is a non-zero integer
- + \ No newline at end of file diff --git a/docs/1.0.22-alpha/api/validationscope/index.html b/docs/1.0.22-alpha/api/validationscope/index.html index fa5473e749..622b095811 100644 --- a/docs/1.0.22-alpha/api/validationscope/index.html +++ b/docs/1.0.22-alpha/api/validationscope/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.22-alpha

validationScope

keywords​

  • keywords: { "alpha": "only letters", "alphanumeric": "only letters and digits", "lowercase": "only lowercase letters", "uppercase": "only uppercase letters", "creditCard": "a valid credit card number", "email": "a valid email", "uuid": "a valid UUID", "parsedNumber": "a well-formed numeric string", "parsedInteger": "a well-formed integer string", "parsedDate": "a valid date", "semver": "a valid semantic version", "json": "a JSON-parsable string", "integer": "an integer"}

text​

NameTypeDescription
alpha stringonly letters
alphanumeric stringonly letters and digits
lowercase stringonly lowercase letters
uppercase stringonly uppercase letters
creditCard stringa valid credit card number
email stringa valid email
uuid stringa valid UUID
parsedNumber (In: string) => numbera well-formed numeric string
parsedInteger (In: string) => numbera well-formed integer string
parsedDate (In: string) => Datea valid date
semver stringa valid semantic version
json (In: string) => unknowna JSON-parsable string
integer numberan integer
- + \ No newline at end of file diff --git a/docs/1.0.22-alpha/api/valueof/index.html b/docs/1.0.22-alpha/api/valueof/index.html index bf57124172..2feadd05d5 100644 --- a/docs/1.0.22-alpha/api/valueof/index.html +++ b/docs/1.0.22-alpha/api/valueof/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.22-alpha

valueOf

operator​

tuple​

  • ["===", T]
  • const tupleValueOf = type(["valueOf", {a:"string"}])

helper​

  • valueOf(T)
  • const helperValueOf = valueOf({a:"string"})
- + \ No newline at end of file diff --git a/docs/1.0.22-alpha/index.html b/docs/1.0.22-alpha/index.html index 23eafc3147..f7ba9597ff 100644 --- a/docs/1.0.22-alpha/index.html +++ b/docs/1.0.22-alpha/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.22-alpha

Getting Started

Install 📦12KB gzipped, 0 dependencies​

Npm Icon npm install arktype(or whatever package manager you prefer)

Our types are tested in strict-mode with TypeScript versions 4.8, 4.9, and 5.0.

Our APIs have mostly stabilized, but details may still change during the alpha/beta stages of our 1.0 release. If you have suggestions that may require a breaking change, now is the time to let us know! ⛵

Your first type​

- + \ No newline at end of file diff --git a/docs/1.0.22-alpha/scopes/index.html b/docs/1.0.22-alpha/scopes/index.html index ad7e9b2fa8..a96e856245 100644 --- a/docs/1.0.22-alpha/scopes/index.html +++ b/docs/1.0.22-alpha/scopes/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.22-alpha

Scopes

- + \ No newline at end of file diff --git a/docs/1.0.23-alpha/api/ark/index.html b/docs/1.0.23-alpha/api/ark/index.html index 3d32419428..68ad7a5f40 100644 --- a/docs/1.0.23-alpha/api/ark/index.html +++ b/docs/1.0.23-alpha/api/ark/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.23-alpha

ark

text​

ark: Space<PrecompiledDefaults>
- + \ No newline at end of file diff --git a/docs/1.0.23-alpha/api/arkscope/index.html b/docs/1.0.23-alpha/api/arkscope/index.html index 8c1b6c4d54..27ff621760 100644 --- a/docs/1.0.23-alpha/api/arkscope/index.html +++ b/docs/1.0.23-alpha/api/arkscope/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.23-alpha

arkScope

text​

arkScope: import("./scope.js").Scope<
[
{
any: any
bigint: bigint
boolean: boolean
false: false
never: never
null: null
number: number
object: object
string: string
symbol: symbol
true: true
unknown: unknown
void: void
undefined: undefined
Function: (...args: any[]) => unknown
Date: Date
Error: Error
Map: Map<unknown, unknown>
RegExp: RegExp
Set: Set<unknown>
WeakMap: WeakMap<object, unknown>
WeakSet: WeakSet<object>
Promise: Promise<unknown>
alpha: string
alphanumeric: string
lowercase: string
uppercase: string
creditCard: string
email: string
uuid: string
parsedNumber: (In: string) => number
parsedInteger: (In: string) => number
parsedDate: (In: string) => Date
semver: string
json: (In: string) => unknown
integer: number
},
{},
false
]
>
- + \ No newline at end of file diff --git a/docs/1.0.23-alpha/api/arrayof/index.html b/docs/1.0.23-alpha/api/arrayof/index.html index e5cf7aef08..7d9c1acf1f 100644 --- a/docs/1.0.23-alpha/api/arrayof/index.html +++ b/docs/1.0.23-alpha/api/arrayof/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.23-alpha

arrayOf

operator​

string​

  • "T[]"
  • const numberArray = type("number[]")

tuple​

  • [T, "[]"]
  • const tupleArray = type(["number", "[]"])

helper​

  • arrayOf(T)
  • const helperArray = arrayOf("number")
- + \ No newline at end of file diff --git a/docs/1.0.23-alpha/api/index.html b/docs/1.0.23-alpha/api/index.html index 387f60b7ba..f054b3ac11 100644 --- a/docs/1.0.23-alpha/api/index.html +++ b/docs/1.0.23-alpha/api/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.23-alpha

API

ArkType supports many of TypeScript's built-in types and operators, as well as some new ones dedicated exclusively to runtime validation. In fact, we got a little ahead of ourselves and built a ton of cool features, but we're still working on getting caught up syntax and API docs. Keep an eye out for more in the next couple weeks ⛵

In the meantime, check out the examples here and use the type hints you get to learn how you can customize your types and scopes. If you want to explore some of the more advanced features, take a look at our unit tests or ask us on Discord if your functionality is supported. If not, create a GitHub issue so we can prioritize it!

- + \ No newline at end of file diff --git a/docs/1.0.23-alpha/api/infer/index.html b/docs/1.0.23-alpha/api/infer/index.html index d87f3cf998..8afaaf6111 100644 --- a/docs/1.0.23-alpha/api/infer/index.html +++ b/docs/1.0.23-alpha/api/infer/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.23-alpha

Infer

text​

export type Infer<t> = {
[as]?: t
}
- + \ No newline at end of file diff --git a/docs/1.0.23-alpha/api/instanceof/index.html b/docs/1.0.23-alpha/api/instanceof/index.html index 0bac5836ee..5f8e4a0d53 100644 --- a/docs/1.0.23-alpha/api/instanceof/index.html +++ b/docs/1.0.23-alpha/api/instanceof/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.23-alpha

instanceOf

operator​

tuple​

  • ["instanceOf", T]
  • const tupleInstanceOf = type(["instanceOf", Date])

helper​

  • instanceOf(T)
  • const helperInstanceOf = instanceOf(Date)
- + \ No newline at end of file diff --git a/docs/1.0.23-alpha/api/intersection/index.html b/docs/1.0.23-alpha/api/intersection/index.html index 2abb07cc10..9c14ae10a1 100644 --- a/docs/1.0.23-alpha/api/intersection/index.html +++ b/docs/1.0.23-alpha/api/intersection/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.23-alpha

intersection

operator​

string​

  • "L&R"
  • const intersection = type("/@arktype.io$/ & email")

tuple​

  • [L, "&", R]
  • const tupleIntersection = type(["/@arktype.io$/", "&", "email"])

helper​

  • intersection(L,R)
  • const helperIntersection = intersection("/@arktype.io$/","email")
- + \ No newline at end of file diff --git a/docs/1.0.23-alpha/api/jsobjectsscope/index.html b/docs/1.0.23-alpha/api/jsobjectsscope/index.html index 0c99597113..8d37865191 100644 --- a/docs/1.0.23-alpha/api/jsobjectsscope/index.html +++ b/docs/1.0.23-alpha/api/jsobjectsscope/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.23-alpha

jsObjectsScope

text​

NameTypeDescription
Function (...args: any[]) => unknown
Date Date
Error Error
Map Map<unknown, unknown>
RegExp RegExp
Set Set<unknown>
WeakMap WeakMap<object, unknown>
WeakSet WeakSet<object>
Promise Promise<unknown>
- + \ No newline at end of file diff --git a/docs/1.0.23-alpha/api/keyof/index.html b/docs/1.0.23-alpha/api/keyof/index.html index 37a432943c..49b8c30789 100644 --- a/docs/1.0.23-alpha/api/keyof/index.html +++ b/docs/1.0.23-alpha/api/keyof/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.23-alpha

keyOf

operator​

tuple​

  • "["keyOf", T]"
  • const tupleKeyOf = type(["keyOf", {a:"string"}])

helper​

  • keyOf(T)
  • const helperKeyOf = keyOf({a:"string"})
- + \ No newline at end of file diff --git a/docs/1.0.23-alpha/api/keywords/index.html b/docs/1.0.23-alpha/api/keywords/index.html index 92f6dac23c..36ec8852de 100644 --- a/docs/1.0.23-alpha/api/keywords/index.html +++ b/docs/1.0.23-alpha/api/keywords/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.23-alpha

Keywords

jsObjectsScope​

NameTypeDescription
Function (...args: any[]) => unknown
Date Date
Error Error
Map Map<unknown, unknown>
RegExp RegExp
Set Set<unknown>
WeakMap WeakMap<object, unknown>
WeakSet WeakSet<object>
Promise Promise<unknown>

tsKeywordsScope​

NameTypeDescription
any anyany
bigint biginta bigint
boolean booleana boolean
false falsefalse
never nevernever
null nullnull
number numbera number
object objectan object
string stringa string
symbol symbola symbol
true truetrue
unknown unknownunknown
void voidvoid
undefined undefinedundefined

validationScope​

NameTypeDescription
alpha stringonly letters
alphanumeric stringonly letters and digits
lowercase stringonly lowercase letters
uppercase stringonly uppercase letters
creditCard stringa valid credit card number
email stringa valid email
uuid stringa valid UUID
parsedNumber (In: string) => numbera well-formed numeric string
parsedInteger (In: string) => numbera well-formed integer string
parsedDate (In: string) => Datea valid date
semver stringa valid semantic version
json (In: string) => unknowna JSON-parsable string
integer numberan integer
- + \ No newline at end of file diff --git a/docs/1.0.23-alpha/api/morph/index.html b/docs/1.0.23-alpha/api/morph/index.html index 3bcf25b511..2984da14f2 100644 --- a/docs/1.0.23-alpha/api/morph/index.html +++ b/docs/1.0.23-alpha/api/morph/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.23-alpha

morph

operator​

tuple​

  • [inputType, "|>", (data) => output]
  • const tupleMorph = type( ["string", "|>" , (data) => `morphed ${data}`])

helper​

  • morph(inputType, (data) => output)
  • const helperMorph = morph("string", (data) => `morphed ${data}`)
- + \ No newline at end of file diff --git a/docs/1.0.23-alpha/api/narrow/index.html b/docs/1.0.23-alpha/api/narrow/index.html index 136b08a5c2..7e34af5150 100644 --- a/docs/1.0.23-alpha/api/narrow/index.html +++ b/docs/1.0.23-alpha/api/narrow/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.23-alpha

narrow

operator​

tuple​

  • ["type", "=>" , condition]
  • const narrow = type( ["number", "=>" , (n) => n % 2 === 0])

example​

  •      const isEven = (x: unknown): x is number => x % 2 === 0
- + \ No newline at end of file diff --git a/docs/1.0.23-alpha/api/operators/index.html b/docs/1.0.23-alpha/api/operators/index.html index 7341176f49..a63dd9eff1 100644 --- a/docs/1.0.23-alpha/api/operators/index.html +++ b/docs/1.0.23-alpha/api/operators/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.23-alpha

Operators

Operating Table​

operatorstringtuplehelper
arrayOf"T[]"[T, "[]"]arrayOf(T)
instanceOf["instanceOf", T]instanceOf(T)
&"L&R"[L, "&", R]intersection(L,R)
keyOf"["keyOf", T]"keyOf(T)
|>[inputType, "|>", (data) => output]morph(inputType, (data) => output)
=>["type", "=>" , condition]
|"L|R"[L, "|" , R]union(L,R)
===["===", T]valueOf(T)
:["type", ":", config]
bound"N<S<N", with comparators restricted to < or <=
%"N%D", where "N" is a number and "D" is a non-zero integer
node["node", nodeDefinition]type.from(nodeDefinition)
- + \ No newline at end of file diff --git a/docs/1.0.23-alpha/api/parseconfigtuple/index.html b/docs/1.0.23-alpha/api/parseconfigtuple/index.html index 7926c282d6..bc1f03eb38 100644 --- a/docs/1.0.23-alpha/api/parseconfigtuple/index.html +++ b/docs/1.0.23-alpha/api/parseconfigtuple/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.23-alpha

parseConfigTuple

operator​

tuple​

  • ["type", ":", config]
- + \ No newline at end of file diff --git a/docs/1.0.23-alpha/api/problem/index.html b/docs/1.0.23-alpha/api/problem/index.html index 9f18aeae55..7df27d06df 100644 --- a/docs/1.0.23-alpha/api/problem/index.html +++ b/docs/1.0.23-alpha/api/problem/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.23-alpha

Problem

text​

export declare class Problem<code extends ProblemCode = ProblemCode> {
code: code
path: Path
private data
private source
private writers
parts?: Problem[]
constructor(
code: code,
path: Path,
data: ProblemData<code>,
source: ProblemSource<code>,
writers: ProblemWriters<code>
)
toString(): string
get message(): string
get reason(): string
get mustBe(): string
}
- + \ No newline at end of file diff --git a/docs/1.0.23-alpha/api/problems/index.html b/docs/1.0.23-alpha/api/problems/index.html index 27e4579f36..0e7e67bc7e 100644 --- a/docs/1.0.23-alpha/api/problems/index.html +++ b/docs/1.0.23-alpha/api/problems/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.23-alpha

Problems

text​

Problems: new (state: TraversalState) => Problems
export type Problems = arraySubclassToReadonly<ProblemArray>;
- + \ No newline at end of file diff --git a/docs/1.0.23-alpha/api/resolvednode/index.html b/docs/1.0.23-alpha/api/resolvednode/index.html index 99de2eb82b..8353a1640b 100644 --- a/docs/1.0.23-alpha/api/resolvednode/index.html +++ b/docs/1.0.23-alpha/api/resolvednode/index.html @@ -7,13 +7,13 @@ - +
- + \ No newline at end of file diff --git a/docs/1.0.23-alpha/api/scope/index.html b/docs/1.0.23-alpha/api/scope/index.html index cc314e57f5..2baf2878e3 100644 --- a/docs/1.0.23-alpha/api/scope/index.html +++ b/docs/1.0.23-alpha/api/scope/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.23-alpha

scope

text​

scope: ScopeParser

hide_table_of_contents: true​

Scope

text​

export declare class Scope<context extends ScopeContext = any> {
#private
aliases: Dict
name: string
config: ScopeConfig
parseCache: FreezingCache<Node>
constructor(aliases: Dict, opts?: ScopeOptions)
getAnonymousQualifiedName(base: AnonymousTypeName): QualifiedTypeName
addAnonymousTypeReference(referencedType: Type, ctx: ParseContext): Node
get infer(): exportsOf<context>
compile(): Space<exportsOf<context>>
addParsedReferenceIfResolvable(
name: name<context>,
ctx: ParseContext
): boolean
resolve(name: name<context>): Type
resolveNode(node: Node): ResolvedNode
resolveTypeNode(node: Node): TypeNode
expressions: Expressions<resolutions<context>>
intersection: import("./expressions.js").BinaryExpressionParser<
resolutions<context>,
"&"
>
union: import("./expressions.js").BinaryExpressionParser<
resolutions<context>,
"|"
>
arrayOf: import("./expressions.js").UnaryExpressionParser<
resolutions<context>,
"[]"
>
keyOf: import("./expressions.js").UnaryExpressionParser<
resolutions<context>,
"keyof"
>
valueOf: import("./expressions.js").UnvalidatedExpressionParser<
resolutions<context>,
"==="
>
instanceOf: import("./expressions.js").UnvalidatedExpressionParser<
resolutions<context>,
"instanceof"
>
narrow: import("./expressions.js").FunctionalExpressionParser<
resolutions<context>,
"=>"
>
morph: import("./expressions.js").FunctionalExpressionParser<
resolutions<context>,
"|>"
>
type: TypeParser<resolutions<context>>
isResolvable(name: string): unknown
}
- + \ No newline at end of file diff --git a/docs/1.0.23-alpha/api/space/index.html b/docs/1.0.23-alpha/api/space/index.html index b4c6973612..9fc9f7d7d3 100644 --- a/docs/1.0.23-alpha/api/space/index.html +++ b/docs/1.0.23-alpha/api/space/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.23-alpha

Space

text​

export type Space<exports = Dict> = {
[k in keyof exports]: Type<exports[k]>
}
- + \ No newline at end of file diff --git a/docs/1.0.23-alpha/api/tskeywordsscope/index.html b/docs/1.0.23-alpha/api/tskeywordsscope/index.html index 7a182a3903..40c0595983 100644 --- a/docs/1.0.23-alpha/api/tskeywordsscope/index.html +++ b/docs/1.0.23-alpha/api/tskeywordsscope/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.23-alpha

tsKeywordsScope

keywords​

  • keywords: {"any": "any", "bigint": "a bigint", "boolean": "a boolean", "false": "false", "never": "never", "null": "null", "number": "a number", "object": "an object", "string": "a string", "symbol": "a symbol", "true": "true", "unknown": "unknown", "void": "void", "undefined": "undefined"}

text​

NameTypeDescription
any anyany
bigint biginta bigint
boolean booleana boolean
false falsefalse
never nevernever
null nullnull
number numbera number
object objectan object
string stringa string
symbol symbola symbol
true truetrue
unknown unknownunknown
void voidvoid
undefined undefinedundefined
- + \ No newline at end of file diff --git a/docs/1.0.23-alpha/api/type/index.html b/docs/1.0.23-alpha/api/type/index.html index 199a1e37fc..4810890399 100644 --- a/docs/1.0.23-alpha/api/type/index.html +++ b/docs/1.0.23-alpha/api/type/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.23-alpha

type

text​

type: TypeParser<PrecompiledDefaults>

hide_table_of_contents: true​

Type

text​

export type Type<t = unknown> = defer<Checker<t> & TypeRoot<t>>
- + \ No newline at end of file diff --git a/docs/1.0.23-alpha/api/union/index.html b/docs/1.0.23-alpha/api/union/index.html index 0a98c03d02..88c7cf562f 100644 --- a/docs/1.0.23-alpha/api/union/index.html +++ b/docs/1.0.23-alpha/api/union/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.23-alpha

union

operator​

string​

  • "L|R"
  • const union = type("string|number")

tuple​

  • [L, "|" , R]
  • const tupleUnion = type(["string", "|", "number"])

helper​

  • union(L,R)
  • const helperUnion = union("string", "number")
- + \ No newline at end of file diff --git a/docs/1.0.23-alpha/api/validatebound/index.html b/docs/1.0.23-alpha/api/validatebound/index.html index 6a17c9f78f..c2bded993d 100644 --- a/docs/1.0.23-alpha/api/validatebound/index.html +++ b/docs/1.0.23-alpha/api/validatebound/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.23-alpha

validateBound

operator​

tableRow​

VariableDescription
Nnumber literal
Ssized data (a number, string or array)
<Comparator (one of <, <=, ==, >=, >)

description​

  • Bound operators allow data to be bounded in the format "S<N", or as a Range: "N<S<N", with comparators restricted to < or <=

string​

  • "N<S<N", with comparators restricted to < or <=
  • const range = type("2<=number<5")
  • const bound = type("string[]==5")
- + \ No newline at end of file diff --git a/docs/1.0.23-alpha/api/validatedivisor/index.html b/docs/1.0.23-alpha/api/validatedivisor/index.html index 3b87c16182..2aad2e3b23 100644 --- a/docs/1.0.23-alpha/api/validatedivisor/index.html +++ b/docs/1.0.23-alpha/api/validatedivisor/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.23-alpha

validateDivisor

operator​

string​

  • "N%D", where "N" is a number and "D" is a non-zero integer
- + \ No newline at end of file diff --git a/docs/1.0.23-alpha/api/validationscope/index.html b/docs/1.0.23-alpha/api/validationscope/index.html index f2390c210f..38b90c0aff 100644 --- a/docs/1.0.23-alpha/api/validationscope/index.html +++ b/docs/1.0.23-alpha/api/validationscope/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.23-alpha

validationScope

keywords​

  • keywords: { "alpha": "only letters", "alphanumeric": "only letters and digits", "lowercase": "only lowercase letters", "uppercase": "only uppercase letters", "creditCard": "a valid credit card number", "email": "a valid email", "uuid": "a valid UUID", "parsedNumber": "a well-formed numeric string", "parsedInteger": "a well-formed integer string", "parsedDate": "a valid date", "semver": "a valid semantic version", "json": "a JSON-parsable string", "integer": "an integer"}

text​

NameTypeDescription
alpha stringonly letters
alphanumeric stringonly letters and digits
lowercase stringonly lowercase letters
uppercase stringonly uppercase letters
creditCard stringa valid credit card number
email stringa valid email
uuid stringa valid UUID
parsedNumber (In: string) => numbera well-formed numeric string
parsedInteger (In: string) => numbera well-formed integer string
parsedDate (In: string) => Datea valid date
semver stringa valid semantic version
json (In: string) => unknowna JSON-parsable string
integer numberan integer
- + \ No newline at end of file diff --git a/docs/1.0.23-alpha/api/valueof/index.html b/docs/1.0.23-alpha/api/valueof/index.html index 52523bcedd..b38b49f53b 100644 --- a/docs/1.0.23-alpha/api/valueof/index.html +++ b/docs/1.0.23-alpha/api/valueof/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.23-alpha

valueOf

operator​

tuple​

  • ["===", T]
  • const tupleValueOf = type(["valueOf", {a:"string"}])

helper​

  • valueOf(T)
  • const helperValueOf = valueOf({a:"string"})
- + \ No newline at end of file diff --git a/docs/1.0.23-alpha/index.html b/docs/1.0.23-alpha/index.html index b63d55eb45..efc3e60f8b 100644 --- a/docs/1.0.23-alpha/index.html +++ b/docs/1.0.23-alpha/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.23-alpha

Getting Started

Install 📦12KB gzipped, 0 dependencies​

Npm Icon npm install arktype(or whatever package manager you prefer)

Our types are tested in strict-mode with TypeScript versions 4.8, 4.9, and 5.0.

Our APIs have mostly stabilized, but details may still change during the alpha/beta stages of our 1.0 release. If you have suggestions that may require a breaking change, now is the time to let us know! ⛵

Your first type​

- + \ No newline at end of file diff --git a/docs/1.0.23-alpha/scopes/index.html b/docs/1.0.23-alpha/scopes/index.html index 202780e385..c331d2f057 100644 --- a/docs/1.0.23-alpha/scopes/index.html +++ b/docs/1.0.23-alpha/scopes/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.23-alpha

Scopes

- + \ No newline at end of file diff --git a/docs/1.0.24-alpha/api/ark/index.html b/docs/1.0.24-alpha/api/ark/index.html index 4003505c90..a27557c3f9 100644 --- a/docs/1.0.24-alpha/api/ark/index.html +++ b/docs/1.0.24-alpha/api/ark/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.24-alpha

ark

text​

ark: Space<PrecompiledDefaults>
- + \ No newline at end of file diff --git a/docs/1.0.24-alpha/api/arkscope/index.html b/docs/1.0.24-alpha/api/arkscope/index.html index 5cafa43f58..8b7d3f3da7 100644 --- a/docs/1.0.24-alpha/api/arkscope/index.html +++ b/docs/1.0.24-alpha/api/arkscope/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.24-alpha

arkScope

text​

arkScope: import("./scope.js").Scope<
[
{
any: any
bigint: bigint
boolean: boolean
false: false
never: never
null: null
number: number
object: object
string: string
symbol: symbol
true: true
unknown: unknown
void: void
undefined: undefined
Function: (...args: any[]) => unknown
Date: Date
Error: Error
Map: Map<unknown, unknown>
RegExp: RegExp
Set: Set<unknown>
WeakMap: WeakMap<object, unknown>
WeakSet: WeakSet<object>
Promise: Promise<unknown>
alpha: string
alphanumeric: string
lowercase: string
uppercase: string
creditCard: string
email: string
uuid: string
parsedNumber: (In: string) => number
parsedInteger: (In: string) => number
parsedDate: (In: string) => Date
semver: string
json: (In: string) => unknown
integer: number
},
{},
false
]
>
- + \ No newline at end of file diff --git a/docs/1.0.24-alpha/api/arrayof/index.html b/docs/1.0.24-alpha/api/arrayof/index.html index 944bf4748c..241924ac7d 100644 --- a/docs/1.0.24-alpha/api/arrayof/index.html +++ b/docs/1.0.24-alpha/api/arrayof/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.24-alpha

arrayOf

operator​

string​

  • "T[]"
  • const numberArray = type("number[]")

tuple​

  • [T, "[]"]
  • const tupleArray = type(["number", "[]"])

helper​

  • arrayOf(T)
  • const helperArray = arrayOf("number")
- + \ No newline at end of file diff --git a/docs/1.0.24-alpha/api/index.html b/docs/1.0.24-alpha/api/index.html index 9ae25c20d6..5087255eb7 100644 --- a/docs/1.0.24-alpha/api/index.html +++ b/docs/1.0.24-alpha/api/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.24-alpha

API

ArkType supports many of TypeScript's built-in types and operators, as well as some new ones dedicated exclusively to runtime validation. In fact, we got a little ahead of ourselves and built a ton of cool features, but we're still working on getting caught up syntax and API docs. Keep an eye out for more in the next couple weeks ⛵

In the meantime, check out the examples here and use the type hints you get to learn how you can customize your types and scopes. If you want to explore some of the more advanced features, take a look at our unit tests or ask us on Discord if your functionality is supported. If not, create a GitHub issue so we can prioritize it!

- + \ No newline at end of file diff --git a/docs/1.0.24-alpha/api/infer/index.html b/docs/1.0.24-alpha/api/infer/index.html index 31d4818d2f..7c4698c322 100644 --- a/docs/1.0.24-alpha/api/infer/index.html +++ b/docs/1.0.24-alpha/api/infer/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.24-alpha

Infer

text​

export type Infer<t> = {
[as]?: t
}
- + \ No newline at end of file diff --git a/docs/1.0.24-alpha/api/inferdefinition/index.html b/docs/1.0.24-alpha/api/inferdefinition/index.html index c752645fe2..eb5224fc01 100644 --- a/docs/1.0.24-alpha/api/inferdefinition/index.html +++ b/docs/1.0.24-alpha/api/inferdefinition/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.24-alpha

inferDefinition

text​

export type inferDefinition<def, $> = isAny<def> extends true
? never
: def extends Infer<infer t> | InferredThunk<infer t>
? t
: def extends string
? inferString<def, $>
: def extends List
? inferTuple<def, $>
: def extends RegExp
? string
: def extends Dict
? inferRecord<def, $>
: never
- + \ No newline at end of file diff --git a/docs/1.0.24-alpha/api/instanceof/index.html b/docs/1.0.24-alpha/api/instanceof/index.html index 5200fe20c8..5cba2ddda0 100644 --- a/docs/1.0.24-alpha/api/instanceof/index.html +++ b/docs/1.0.24-alpha/api/instanceof/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.24-alpha

instanceOf

operator​

tuple​

  • ["instanceOf", T]
  • const tupleInstanceOf = type(["instanceOf", Date])

helper​

  • instanceOf(T)
  • const helperInstanceOf = instanceOf(Date)
- + \ No newline at end of file diff --git a/docs/1.0.24-alpha/api/intersection/index.html b/docs/1.0.24-alpha/api/intersection/index.html index d4373c5821..369133dfd6 100644 --- a/docs/1.0.24-alpha/api/intersection/index.html +++ b/docs/1.0.24-alpha/api/intersection/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.24-alpha

intersection

operator​

string​

  • "L&R"
  • const intersection = type("/@arktype.io$/ & email")

tuple​

  • [L, "&", R]
  • const tupleIntersection = type(["/@arktype.io$/", "&", "email"])

helper​

  • intersection(L,R)
  • const helperIntersection = intersection("/@arktype.io$/","email")
- + \ No newline at end of file diff --git a/docs/1.0.24-alpha/api/jsobjectsscope/index.html b/docs/1.0.24-alpha/api/jsobjectsscope/index.html index 523c3e68ae..7587dcfd9d 100644 --- a/docs/1.0.24-alpha/api/jsobjectsscope/index.html +++ b/docs/1.0.24-alpha/api/jsobjectsscope/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.24-alpha

jsObjectsScope

text​

NameTypeDescription
Function (...args: any[]) => unknown
Date Date
Error Error
Map Map<unknown, unknown>
RegExp RegExp
Set Set<unknown>
WeakMap WeakMap<object, unknown>
WeakSet WeakSet<object>
Promise Promise<unknown>
- + \ No newline at end of file diff --git a/docs/1.0.24-alpha/api/keyof/index.html b/docs/1.0.24-alpha/api/keyof/index.html index 08e084d343..f8480fea90 100644 --- a/docs/1.0.24-alpha/api/keyof/index.html +++ b/docs/1.0.24-alpha/api/keyof/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.24-alpha

keyOf

operator​

tuple​

  • "["keyOf", T]"
  • const tupleKeyOf = type(["keyOf", {a:"string"}])

helper​

  • keyOf(T)
  • const helperKeyOf = keyOf({a:"string"})
- + \ No newline at end of file diff --git a/docs/1.0.24-alpha/api/keywords/index.html b/docs/1.0.24-alpha/api/keywords/index.html index 1cda49b16c..8dc5262359 100644 --- a/docs/1.0.24-alpha/api/keywords/index.html +++ b/docs/1.0.24-alpha/api/keywords/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.24-alpha

Keywords

jsObjectsScope​

NameTypeDescription
Function (...args: any[]) => unknown
Date Date
Error Error
Map Map<unknown, unknown>
RegExp RegExp
Set Set<unknown>
WeakMap WeakMap<object, unknown>
WeakSet WeakSet<object>
Promise Promise<unknown>

tsKeywordsScope​

NameTypeDescription
any anyany
bigint biginta bigint
boolean booleana boolean
false falsefalse
never nevernever
null nullnull
number numbera number
object objectan object
string stringa string
symbol symbola symbol
true truetrue
unknown unknownunknown
void voidvoid
undefined undefinedundefined

validationScope​

NameTypeDescription
alpha stringonly letters
alphanumeric stringonly letters and digits
lowercase stringonly lowercase letters
uppercase stringonly uppercase letters
creditCard stringa valid credit card number
email stringa valid email
uuid stringa valid UUID
parsedNumber (In: string) => numbera well-formed numeric string
parsedInteger (In: string) => numbera well-formed integer string
parsedDate (In: string) => Datea valid date
semver stringa valid semantic version
json (In: string) => unknowna JSON-parsable string
integer numberan integer
- + \ No newline at end of file diff --git a/docs/1.0.24-alpha/api/morph/index.html b/docs/1.0.24-alpha/api/morph/index.html index 65b1dcefc0..9e226f6436 100644 --- a/docs/1.0.24-alpha/api/morph/index.html +++ b/docs/1.0.24-alpha/api/morph/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.24-alpha

morph

operator​

tuple​

  • [inputType, "|>", (data) => output]
  • const tupleMorph = type( ["string", "|>" , (data) => `morphed ${data}`])

helper​

  • morph(inputType, (data) => output)
  • const helperMorph = morph("string", (data) => `morphed ${data}`)
- + \ No newline at end of file diff --git a/docs/1.0.24-alpha/api/narrow/index.html b/docs/1.0.24-alpha/api/narrow/index.html index 8e0ee06ebf..f6d8a60488 100644 --- a/docs/1.0.24-alpha/api/narrow/index.html +++ b/docs/1.0.24-alpha/api/narrow/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.24-alpha

narrow

operator​

tuple​

  • ["type", "=>" , condition]
  • const narrow = type( ["number", "=>" , (n) => n % 2 === 0])

example​

  •      const isEven = (x: unknown): x is number => x % 2 === 0
- + \ No newline at end of file diff --git a/docs/1.0.24-alpha/api/operators/index.html b/docs/1.0.24-alpha/api/operators/index.html index 8bbf4f3006..a7f4ae07aa 100644 --- a/docs/1.0.24-alpha/api/operators/index.html +++ b/docs/1.0.24-alpha/api/operators/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.24-alpha

Operators

Operating Table​

operatorstringtuplehelper
arrayOf"T[]"[T, "[]"]arrayOf(T)
instanceOf["instanceOf", T]instanceOf(T)
&"L&R"[L, "&", R]intersection(L,R)
keyOf"["keyOf", T]"keyOf(T)
|>[inputType, "|>", (data) => output]morph(inputType, (data) => output)
=>["type", "=>" , condition]
|"L|R"[L, "|" , R]union(L,R)
===["===", T]valueOf(T)
:["type", ":", config]
bound"N<S<N", with comparators restricted to < or <=
%"N%D", where "N" is a number and "D" is a non-zero integer
node["node", nodeDefinition]type.from(nodeDefinition)
- + \ No newline at end of file diff --git a/docs/1.0.24-alpha/api/parseconfigtuple/index.html b/docs/1.0.24-alpha/api/parseconfigtuple/index.html index 7dab00476b..51d4330ea2 100644 --- a/docs/1.0.24-alpha/api/parseconfigtuple/index.html +++ b/docs/1.0.24-alpha/api/parseconfigtuple/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.24-alpha

parseConfigTuple

operator​

tuple​

  • ["type", ":", config]
- + \ No newline at end of file diff --git a/docs/1.0.24-alpha/api/precompileddefaults/index.html b/docs/1.0.24-alpha/api/precompileddefaults/index.html index ad742a5819..1f72248432 100644 --- a/docs/1.0.24-alpha/api/precompileddefaults/index.html +++ b/docs/1.0.24-alpha/api/precompileddefaults/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.24-alpha

PrecompiledDefaults

text​

export type PrecompiledDefaults = {
any: any
bigint: bigint
boolean: boolean
false: false
never: never
null: null
number: number
object: object
string: string
symbol: symbol
true: true
unknown: unknown
void: void
undefined: undefined
integer: number
alpha: string
alphanumeric: string
lowercase: string
uppercase: string
creditCard: string
email: string
uuid: string
semver: string
json: (In: string) => unknown
parsedNumber: (In: string) => number
parsedInteger: (In: string) => number
parsedDate: (In: string) => Date
Function: (...args: any[]) => unknown
Date: Date
Error: Error
Map: Map<unknown, unknown>
RegExp: RegExp
Set: Set<unknown>
WeakMap: WeakMap<object, unknown>
WeakSet: WeakSet<object>
Promise: Promise<unknown>
}
- + \ No newline at end of file diff --git a/docs/1.0.24-alpha/api/problem/index.html b/docs/1.0.24-alpha/api/problem/index.html index 5adb834bb9..d32ab78351 100644 --- a/docs/1.0.24-alpha/api/problem/index.html +++ b/docs/1.0.24-alpha/api/problem/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.24-alpha

Problem

text​

export declare class Problem<code extends ProblemCode = ProblemCode> {
code: code
path: Path
private data
private source
private writers
parts?: Problem[]
constructor(
code: code,
path: Path,
data: ProblemData<code>,
source: ProblemSource<code>,
writers: ProblemWriters<code>
)
toString(): string
get message(): string
get reason(): string
get mustBe(): string
}
- + \ No newline at end of file diff --git a/docs/1.0.24-alpha/api/problems/index.html b/docs/1.0.24-alpha/api/problems/index.html index ef4f63663d..629d1a624c 100644 --- a/docs/1.0.24-alpha/api/problems/index.html +++ b/docs/1.0.24-alpha/api/problems/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.24-alpha

Problems

text​

Problems: new (state: TraversalState) => Problems
export type Problems = arraySubclassToReadonly<ProblemArray>;
- + \ No newline at end of file diff --git a/docs/1.0.24-alpha/api/resolvednode/index.html b/docs/1.0.24-alpha/api/resolvednode/index.html index 894353f520..dc2ee389dc 100644 --- a/docs/1.0.24-alpha/api/resolvednode/index.html +++ b/docs/1.0.24-alpha/api/resolvednode/index.html @@ -7,13 +7,13 @@ - +
- + \ No newline at end of file diff --git a/docs/1.0.24-alpha/api/scope/index.html b/docs/1.0.24-alpha/api/scope/index.html index 9d2ca43ade..1961aa2eaa 100644 --- a/docs/1.0.24-alpha/api/scope/index.html +++ b/docs/1.0.24-alpha/api/scope/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.24-alpha

scope

text​

scope: ScopeParser

hide_table_of_contents: true​

Scope

text​

export declare class Scope<context extends ScopeContext = any> {
#private
aliases: Dict
name: string
config: ScopeConfig
parseCache: FreezingCache<Node>
constructor(aliases: Dict, opts?: ScopeOptions)
getAnonymousQualifiedName(base: AnonymousTypeName): QualifiedTypeName
addAnonymousTypeReference(referencedType: Type, ctx: ParseContext): Node
get infer(): exportsOf<context>
compile(): Space<exportsOf<context>>
addParsedReferenceIfResolvable(
name: name<context>,
ctx: ParseContext
): boolean
resolve(name: name<context>): Type
resolveNode(node: Node): ResolvedNode
resolveTypeNode(node: Node): TypeNode
expressions: Expressions<resolutions<context>>
intersection: import("./expressions.js").BinaryExpressionParser<
resolutions<context>,
"&"
>
union: import("./expressions.js").BinaryExpressionParser<
resolutions<context>,
"|"
>
arrayOf: import("./expressions.js").UnaryExpressionParser<
resolutions<context>,
"[]"
>
keyOf: import("./expressions.js").UnaryExpressionParser<
resolutions<context>,
"keyof"
>
valueOf: import("./expressions.js").UnvalidatedExpressionParser<
resolutions<context>,
"==="
>
instanceOf: import("./expressions.js").UnvalidatedExpressionParser<
resolutions<context>,
"instanceof"
>
narrow: import("./expressions.js").FunctionalExpressionParser<
resolutions<context>,
"=>"
>
morph: import("./expressions.js").FunctionalExpressionParser<
resolutions<context>,
"|>"
>
type: TypeParser<resolutions<context>>
isResolvable(name: string): unknown
}
- + \ No newline at end of file diff --git a/docs/1.0.24-alpha/api/space/index.html b/docs/1.0.24-alpha/api/space/index.html index 8b523ee2b5..8a29549208 100644 --- a/docs/1.0.24-alpha/api/space/index.html +++ b/docs/1.0.24-alpha/api/space/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.24-alpha

Space

text​

export type Space<exports = Dict> = {
[k in keyof exports]: Type<exports[k]>
}
- + \ No newline at end of file diff --git a/docs/1.0.24-alpha/api/tskeywordsscope/index.html b/docs/1.0.24-alpha/api/tskeywordsscope/index.html index d4817289ce..acfaddbe39 100644 --- a/docs/1.0.24-alpha/api/tskeywordsscope/index.html +++ b/docs/1.0.24-alpha/api/tskeywordsscope/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.24-alpha

tsKeywordsScope

keywords​

  • keywords: {"any": "any", "bigint": "a bigint", "boolean": "a boolean", "false": "false", "never": "never", "null": "null", "number": "a number", "object": "an object", "string": "a string", "symbol": "a symbol", "true": "true", "unknown": "unknown", "void": "void", "undefined": "undefined"}

text​

NameTypeDescription
any anyany
bigint biginta bigint
boolean booleana boolean
false falsefalse
never nevernever
null nullnull
number numbera number
object objectan object
string stringa string
symbol symbola symbol
true truetrue
unknown unknownunknown
void voidvoid
undefined undefinedundefined
- + \ No newline at end of file diff --git a/docs/1.0.24-alpha/api/type/index.html b/docs/1.0.24-alpha/api/type/index.html index 2d911b60f0..af60889760 100644 --- a/docs/1.0.24-alpha/api/type/index.html +++ b/docs/1.0.24-alpha/api/type/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.24-alpha

type

text​

type: TypeParser<PrecompiledDefaults>

hide_table_of_contents: true​

Type

text​

export type Type<t = unknown> = defer<Checker<t> & TypeRoot<t>>
- + \ No newline at end of file diff --git a/docs/1.0.24-alpha/api/union/index.html b/docs/1.0.24-alpha/api/union/index.html index 4f3761d928..389865535c 100644 --- a/docs/1.0.24-alpha/api/union/index.html +++ b/docs/1.0.24-alpha/api/union/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.24-alpha

union

operator​

string​

  • "L|R"
  • const union = type("string|number")

tuple​

  • [L, "|" , R]
  • const tupleUnion = type(["string", "|", "number"])

helper​

  • union(L,R)
  • const helperUnion = union("string", "number")
- + \ No newline at end of file diff --git a/docs/1.0.24-alpha/api/validatebound/index.html b/docs/1.0.24-alpha/api/validatebound/index.html index 362e2b8d5d..8c3acfd179 100644 --- a/docs/1.0.24-alpha/api/validatebound/index.html +++ b/docs/1.0.24-alpha/api/validatebound/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.24-alpha

validateBound

operator​

tableRow​

VariableDescription
Nnumber literal
Ssized data (a number, string or array)
<Comparator (one of <, <=, ==, >=, >)

description​

  • Bound operators allow data to be bounded in the format "S<N", or as a Range: "N<S<N", with comparators restricted to < or <=

string​

  • "N<S<N", with comparators restricted to < or <=
  • const range = type("2<=number<5")
  • const bound = type("string[]==5")
- + \ No newline at end of file diff --git a/docs/1.0.24-alpha/api/validatedefinition/index.html b/docs/1.0.24-alpha/api/validatedefinition/index.html index 2d9c243aab..33b070d5a5 100644 --- a/docs/1.0.24-alpha/api/validatedefinition/index.html +++ b/docs/1.0.24-alpha/api/validatedefinition/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.24-alpha

validateDefinition

text​

export type validateDefinition<def, $> = [def] extends [(...args: any[]) => any]
? def
: def extends Terminal
? def
: def extends string
? validateString<def, $>
: def extends TupleExpression
? validateTupleExpression<def, $>
: def extends BadDefinitionType
? writeBadDefinitionTypeMessage<
objectKindOf<def> extends string ? objectKindOf<def> : domainOf<def>
>
: isUnknown<def> extends true
? stringKeyOf<$>
: evaluate<{
[k in keyof def]: validateDefinition<def[k], $>
}>
- + \ No newline at end of file diff --git a/docs/1.0.24-alpha/api/validatedivisor/index.html b/docs/1.0.24-alpha/api/validatedivisor/index.html index 6334b6edad..ddd5554ade 100644 --- a/docs/1.0.24-alpha/api/validatedivisor/index.html +++ b/docs/1.0.24-alpha/api/validatedivisor/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.24-alpha

validateDivisor

operator​

string​

  • "N%D", where "N" is a number and "D" is a non-zero integer
- + \ No newline at end of file diff --git a/docs/1.0.24-alpha/api/validationscope/index.html b/docs/1.0.24-alpha/api/validationscope/index.html index 5d2da5403c..e347a835a3 100644 --- a/docs/1.0.24-alpha/api/validationscope/index.html +++ b/docs/1.0.24-alpha/api/validationscope/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.24-alpha

validationScope

keywords​

  • keywords: { "alpha": "only letters", "alphanumeric": "only letters and digits", "lowercase": "only lowercase letters", "uppercase": "only uppercase letters", "creditCard": "a valid credit card number", "email": "a valid email", "uuid": "a valid UUID", "parsedNumber": "a well-formed numeric string", "parsedInteger": "a well-formed integer string", "parsedDate": "a valid date", "semver": "a valid semantic version", "json": "a JSON-parsable string", "integer": "an integer"}

text​

NameTypeDescription
alpha stringonly letters
alphanumeric stringonly letters and digits
lowercase stringonly lowercase letters
uppercase stringonly uppercase letters
creditCard stringa valid credit card number
email stringa valid email
uuid stringa valid UUID
parsedNumber (In: string) => numbera well-formed numeric string
parsedInteger (In: string) => numbera well-formed integer string
parsedDate (In: string) => Datea valid date
semver stringa valid semantic version
json (In: string) => unknowna JSON-parsable string
integer numberan integer
- + \ No newline at end of file diff --git a/docs/1.0.24-alpha/api/valueof/index.html b/docs/1.0.24-alpha/api/valueof/index.html index 3404c4ba8a..ee6b2da2bd 100644 --- a/docs/1.0.24-alpha/api/valueof/index.html +++ b/docs/1.0.24-alpha/api/valueof/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.24-alpha

valueOf

operator​

tuple​

  • ["===", T]
  • const tupleValueOf = type(["valueOf", {a:"string"}])

helper​

  • valueOf(T)
  • const helperValueOf = valueOf({a:"string"})
- + \ No newline at end of file diff --git a/docs/1.0.24-alpha/index.html b/docs/1.0.24-alpha/index.html index 0da9137e45..f5349688f2 100644 --- a/docs/1.0.24-alpha/index.html +++ b/docs/1.0.24-alpha/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.24-alpha

Getting Started

Install 📦12KB gzipped, 0 dependencies​

Npm Icon npm install arktype(or whatever package manager you prefer)

Our types are tested in strict-mode with TypeScript versions 4.8, 4.9, and 5.0.

Our APIs have mostly stabilized, but details may still change during the alpha/beta stages of our 1.0 release. If you have suggestions that may require a breaking change, now is the time to let us know! ⛵

Your first type​

- + \ No newline at end of file diff --git a/docs/1.0.24-alpha/scopes/index.html b/docs/1.0.24-alpha/scopes/index.html index 4730355817..1a7a6f0af7 100644 --- a/docs/1.0.24-alpha/scopes/index.html +++ b/docs/1.0.24-alpha/scopes/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.24-alpha

Scopes

- + \ No newline at end of file diff --git a/docs/1.0.25-alpha/api/ark/index.html b/docs/1.0.25-alpha/api/ark/index.html index b4588c8789..cb0340880c 100644 --- a/docs/1.0.25-alpha/api/ark/index.html +++ b/docs/1.0.25-alpha/api/ark/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.25-alpha

ark

text​

ark: Space<PrecompiledDefaults>
- + \ No newline at end of file diff --git a/docs/1.0.25-alpha/api/arkscope/index.html b/docs/1.0.25-alpha/api/arkscope/index.html index c28a56b830..fbb1e2d26a 100644 --- a/docs/1.0.25-alpha/api/arkscope/index.html +++ b/docs/1.0.25-alpha/api/arkscope/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.25-alpha

arkScope

text​

arkScope: import("./scope.js").Scope<
[
{
any: any
bigint: bigint
boolean: boolean
false: false
never: never
null: null
number: number
object: object
string: string
symbol: symbol
true: true
unknown: unknown
void: void
undefined: undefined
Function: (...args: any[]) => unknown
Date: Date
Error: Error
Map: Map<unknown, unknown>
RegExp: RegExp
Set: Set<unknown>
WeakMap: WeakMap<object, unknown>
WeakSet: WeakSet<object>
Promise: Promise<unknown>
alpha: string
alphanumeric: string
lowercase: string
uppercase: string
creditCard: string
email: string
uuid: string
parsedNumber: (In: string) => number
parsedInteger: (In: string) => number
parsedDate: (In: string) => Date
semver: string
json: (In: string) => unknown
integer: number
},
{},
false
]
>
- + \ No newline at end of file diff --git a/docs/1.0.25-alpha/api/arrayof/index.html b/docs/1.0.25-alpha/api/arrayof/index.html index 1ff0c4b9af..a697d58586 100644 --- a/docs/1.0.25-alpha/api/arrayof/index.html +++ b/docs/1.0.25-alpha/api/arrayof/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.25-alpha

arrayOf

operator​

string​

  • "T[]"
  • const numberArray = type("number[]")

tuple​

  • [T, "[]"]
  • const tupleArray = type(["number", "[]"])

helper​

  • arrayOf(T)
  • const helperArray = arrayOf("number")
- + \ No newline at end of file diff --git a/docs/1.0.25-alpha/api/index.html b/docs/1.0.25-alpha/api/index.html index 497c56d7d8..ba079c0257 100644 --- a/docs/1.0.25-alpha/api/index.html +++ b/docs/1.0.25-alpha/api/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.25-alpha

API

ArkType supports many of TypeScript's built-in types and operators, as well as some new ones dedicated exclusively to runtime validation. In fact, we got a little ahead of ourselves and built a ton of cool features, but we're still working on getting caught up syntax and API docs. Keep an eye out for more in the next couple weeks ⛵

In the meantime, check out the examples here and use the type hints you get to learn how you can customize your types and scopes. If you want to explore some of the more advanced features, take a look at our unit tests or ask us on Discord if your functionality is supported. If not, create a GitHub issue so we can prioritize it!

- + \ No newline at end of file diff --git a/docs/1.0.25-alpha/api/infer/index.html b/docs/1.0.25-alpha/api/infer/index.html index a20952a340..472a173875 100644 --- a/docs/1.0.25-alpha/api/infer/index.html +++ b/docs/1.0.25-alpha/api/infer/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.25-alpha

Infer

text​

export type Infer<t> = {
[as]?: t
}
- + \ No newline at end of file diff --git a/docs/1.0.25-alpha/api/inferdefinition/index.html b/docs/1.0.25-alpha/api/inferdefinition/index.html index d2a17253e1..0ec2c724db 100644 --- a/docs/1.0.25-alpha/api/inferdefinition/index.html +++ b/docs/1.0.25-alpha/api/inferdefinition/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.25-alpha

inferDefinition

text​

export type inferDefinition<def, $> = isAny<def> extends true
? never
: def extends Infer<infer t> | InferredThunk<infer t>
? t
: def extends string
? inferString<def, $>
: def extends List
? inferTuple<def, $>
: def extends RegExp
? string
: def extends Dict
? inferRecord<def, $>
: never
- + \ No newline at end of file diff --git a/docs/1.0.25-alpha/api/instanceof/index.html b/docs/1.0.25-alpha/api/instanceof/index.html index 024794d1d4..b0379f29ec 100644 --- a/docs/1.0.25-alpha/api/instanceof/index.html +++ b/docs/1.0.25-alpha/api/instanceof/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.25-alpha

instanceOf

operator​

tuple​

  • ["instanceOf", T]
  • const tupleInstanceOf = type(["instanceOf", Date])

helper​

  • instanceOf(T)
  • const helperInstanceOf = instanceOf(Date)
- + \ No newline at end of file diff --git a/docs/1.0.25-alpha/api/intersection/index.html b/docs/1.0.25-alpha/api/intersection/index.html index 1ebb18066c..46e0ba1b0e 100644 --- a/docs/1.0.25-alpha/api/intersection/index.html +++ b/docs/1.0.25-alpha/api/intersection/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.25-alpha

intersection

operator​

string​

  • "L&R"
  • const intersection = type("/@arktype.io$/ & email")

tuple​

  • [L, "&", R]
  • const tupleIntersection = type(["/@arktype.io$/", "&", "email"])

helper​

  • intersection(L,R)
  • const helperIntersection = intersection("/@arktype.io$/","email")
- + \ No newline at end of file diff --git a/docs/1.0.25-alpha/api/jsobjectsscope/index.html b/docs/1.0.25-alpha/api/jsobjectsscope/index.html index b27eef6884..01c136b980 100644 --- a/docs/1.0.25-alpha/api/jsobjectsscope/index.html +++ b/docs/1.0.25-alpha/api/jsobjectsscope/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.25-alpha

jsObjectsScope

text​

NameTypeDescription
Function (...args: any[]) => unknown
Date Date
Error Error
Map Map<unknown, unknown>
RegExp RegExp
Set Set<unknown>
WeakMap WeakMap<object, unknown>
WeakSet WeakSet<object>
Promise Promise<unknown>
- + \ No newline at end of file diff --git a/docs/1.0.25-alpha/api/keyof/index.html b/docs/1.0.25-alpha/api/keyof/index.html index aed95e3a5e..43a777d8aa 100644 --- a/docs/1.0.25-alpha/api/keyof/index.html +++ b/docs/1.0.25-alpha/api/keyof/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.25-alpha

keyOf

operator​

tuple​

  • "["keyOf", T]"
  • const tupleKeyOf = type(["keyOf", {a:"string"}])

helper​

  • keyOf(T)
  • const helperKeyOf = keyOf({a:"string"})
- + \ No newline at end of file diff --git a/docs/1.0.25-alpha/api/keywords/index.html b/docs/1.0.25-alpha/api/keywords/index.html index 161d831f94..471eab414b 100644 --- a/docs/1.0.25-alpha/api/keywords/index.html +++ b/docs/1.0.25-alpha/api/keywords/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.25-alpha

Keywords

jsObjectsScope​

NameTypeDescription
Function (...args: any[]) => unknown
Date Date
Error Error
Map Map<unknown, unknown>
RegExp RegExp
Set Set<unknown>
WeakMap WeakMap<object, unknown>
WeakSet WeakSet<object>
Promise Promise<unknown>

tsKeywordsScope​

NameTypeDescription
any anyany
bigint biginta bigint
boolean booleana boolean
false falsefalse
never nevernever
null nullnull
number numbera number
object objectan object
string stringa string
symbol symbola symbol
true truetrue
unknown unknownunknown
void voidvoid
undefined undefinedundefined

validationScope​

NameTypeDescription
alpha stringonly letters
alphanumeric stringonly letters and digits
lowercase stringonly lowercase letters
uppercase stringonly uppercase letters
creditCard stringa valid credit card number
email stringa valid email
uuid stringa valid UUID
parsedNumber (In: string) => numbera well-formed numeric string
parsedInteger (In: string) => numbera well-formed integer string
parsedDate (In: string) => Datea valid date
semver stringa valid semantic version
json (In: string) => unknowna JSON-parsable string
integer numberan integer
- + \ No newline at end of file diff --git a/docs/1.0.25-alpha/api/morph/index.html b/docs/1.0.25-alpha/api/morph/index.html index 0f39f211f8..5bd6e058f1 100644 --- a/docs/1.0.25-alpha/api/morph/index.html +++ b/docs/1.0.25-alpha/api/morph/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.25-alpha

morph

operator​

tuple​

  • [inputType, "|>", (data) => output]
  • const tupleMorph = type( ["string", "|>" , (data) => `morphed ${data}`])

helper​

  • morph(inputType, (data) => output)
  • const helperMorph = morph("string", (data) => `morphed ${data}`)
- + \ No newline at end of file diff --git a/docs/1.0.25-alpha/api/narrow/index.html b/docs/1.0.25-alpha/api/narrow/index.html index 54b35d8b9e..72713ed342 100644 --- a/docs/1.0.25-alpha/api/narrow/index.html +++ b/docs/1.0.25-alpha/api/narrow/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.25-alpha

narrow

operator​

tuple​

  • ["type", "=>" , condition]
  • const narrow = type( ["number", "=>" , (n) => n % 2 === 0])

example​

  •      const isEven = (x: unknown): x is number => x % 2 === 0
- + \ No newline at end of file diff --git a/docs/1.0.25-alpha/api/operators/index.html b/docs/1.0.25-alpha/api/operators/index.html index 9ec9dbe0c2..05eb62844c 100644 --- a/docs/1.0.25-alpha/api/operators/index.html +++ b/docs/1.0.25-alpha/api/operators/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.25-alpha

Operators

Operating Table​

operatorstringtuplehelper
arrayOf"T[]"[T, "[]"]arrayOf(T)
instanceOf["instanceOf", T]instanceOf(T)
&"L&R"[L, "&", R]intersection(L,R)
keyOf"["keyOf", T]"keyOf(T)
|>[inputType, "|>", (data) => output]morph(inputType, (data) => output)
=>["type", "=>" , condition]
|"L|R"[L, "|" , R]union(L,R)
===["===", T]valueOf(T)
:["type", ":", config]
bound"N<S<N", with comparators restricted to < or <=
%"N%D", where "N" is a number and "D" is a non-zero integer
node["node", nodeDefinition]type.from(nodeDefinition)
- + \ No newline at end of file diff --git a/docs/1.0.25-alpha/api/parseconfigtuple/index.html b/docs/1.0.25-alpha/api/parseconfigtuple/index.html index 6e60f72592..be0896e558 100644 --- a/docs/1.0.25-alpha/api/parseconfigtuple/index.html +++ b/docs/1.0.25-alpha/api/parseconfigtuple/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.25-alpha

parseConfigTuple

operator​

tuple​

  • ["type", ":", config]
- + \ No newline at end of file diff --git a/docs/1.0.25-alpha/api/precompileddefaults/index.html b/docs/1.0.25-alpha/api/precompileddefaults/index.html index 11e11511b0..8290194ab3 100644 --- a/docs/1.0.25-alpha/api/precompileddefaults/index.html +++ b/docs/1.0.25-alpha/api/precompileddefaults/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.25-alpha

PrecompiledDefaults

text​

export type PrecompiledDefaults = {
any: any
bigint: bigint
boolean: boolean
false: false
never: never
null: null
number: number
object: object
string: string
symbol: symbol
true: true
unknown: unknown
void: void
undefined: undefined
integer: number
alpha: string
alphanumeric: string
lowercase: string
uppercase: string
creditCard: string
email: string
uuid: string
semver: string
json: (In: string) => unknown
parsedNumber: (In: string) => number
parsedInteger: (In: string) => number
parsedDate: (In: string) => Date
Function: (...args: any[]) => unknown
Date: Date
Error: Error
Map: Map<unknown, unknown>
RegExp: RegExp
Set: Set<unknown>
WeakMap: WeakMap<object, unknown>
WeakSet: WeakSet<object>
Promise: Promise<unknown>
}
- + \ No newline at end of file diff --git a/docs/1.0.25-alpha/api/problem/index.html b/docs/1.0.25-alpha/api/problem/index.html index 24c7942221..ba63ba57ef 100644 --- a/docs/1.0.25-alpha/api/problem/index.html +++ b/docs/1.0.25-alpha/api/problem/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.25-alpha

Problem

text​

export declare class Problem<code extends ProblemCode = ProblemCode> {
code: code
path: Path
private data
private source
private writers
parts?: Problem[]
constructor(
code: code,
path: Path,
data: ProblemData<code>,
source: ProblemSource<code>,
writers: ProblemWriters<code>
)
toString(): string
get message(): string
get reason(): string
get mustBe(): string
}
- + \ No newline at end of file diff --git a/docs/1.0.25-alpha/api/problems/index.html b/docs/1.0.25-alpha/api/problems/index.html index 72e8854985..af807fce9c 100644 --- a/docs/1.0.25-alpha/api/problems/index.html +++ b/docs/1.0.25-alpha/api/problems/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.25-alpha

Problems

text​

Problems: new (state: TraversalState) => Problems
export type Problems = arraySubclassToReadonly<ProblemArray>;
- + \ No newline at end of file diff --git a/docs/1.0.25-alpha/api/resolvednode/index.html b/docs/1.0.25-alpha/api/resolvednode/index.html index f479dd01fe..691d99cd5a 100644 --- a/docs/1.0.25-alpha/api/resolvednode/index.html +++ b/docs/1.0.25-alpha/api/resolvednode/index.html @@ -7,13 +7,13 @@ - +
- + \ No newline at end of file diff --git a/docs/1.0.25-alpha/api/scope/index.html b/docs/1.0.25-alpha/api/scope/index.html index 7af5f3e8d9..35c66bf1f5 100644 --- a/docs/1.0.25-alpha/api/scope/index.html +++ b/docs/1.0.25-alpha/api/scope/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.25-alpha

scope

text​

scope: ScopeParser

hide_table_of_contents: true​

Scope

text​

export declare class Scope<context extends ScopeContext = any> {
#private
aliases: Dict
name: string
config: ScopeConfig
parseCache: FreezingCache<Node>
constructor(aliases: Dict, opts?: ScopeOptions)
getAnonymousQualifiedName(base: AnonymousTypeName): QualifiedTypeName
addAnonymousTypeReference(referencedType: Type, ctx: ParseContext): Node
get infer(): exportsOf<context>
compile(): Space<exportsOf<context>>
addParsedReferenceIfResolvable(
name: name<context>,
ctx: ParseContext
): boolean
resolve(name: name<context>): Type
resolveNode(node: Node): ResolvedNode
resolveTypeNode(node: Node): TypeNode
expressions: Expressions<resolutions<context>>
intersection: import("./expressions.js").BinaryExpressionParser<
resolutions<context>,
"&"
>
union: import("./expressions.js").BinaryExpressionParser<
resolutions<context>,
"|"
>
arrayOf: import("./expressions.js").UnaryExpressionParser<
resolutions<context>,
"[]"
>
keyOf: import("./expressions.js").UnaryExpressionParser<
resolutions<context>,
"keyof"
>
valueOf: import("./expressions.js").UnvalidatedExpressionParser<
resolutions<context>,
"==="
>
instanceOf: import("./expressions.js").UnvalidatedExpressionParser<
resolutions<context>,
"instanceof"
>
narrow: import("./expressions.js").FunctionalExpressionParser<
resolutions<context>,
"=>"
>
morph: import("./expressions.js").FunctionalExpressionParser<
resolutions<context>,
"|>"
>
type: TypeParser<resolutions<context>>
isResolvable(name: string): unknown
}
- + \ No newline at end of file diff --git a/docs/1.0.25-alpha/api/space/index.html b/docs/1.0.25-alpha/api/space/index.html index 1021e5690b..68b803fded 100644 --- a/docs/1.0.25-alpha/api/space/index.html +++ b/docs/1.0.25-alpha/api/space/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.25-alpha

Space

text​

export type Space<exports = Dict> = {
[k in keyof exports]: Type<exports[k]>
}
- + \ No newline at end of file diff --git a/docs/1.0.25-alpha/api/tskeywordsscope/index.html b/docs/1.0.25-alpha/api/tskeywordsscope/index.html index fbf6ab55aa..df71f43407 100644 --- a/docs/1.0.25-alpha/api/tskeywordsscope/index.html +++ b/docs/1.0.25-alpha/api/tskeywordsscope/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.25-alpha

tsKeywordsScope

keywords​

  • keywords: {"any": "any", "bigint": "a bigint", "boolean": "a boolean", "false": "false", "never": "never", "null": "null", "number": "a number", "object": "an object", "string": "a string", "symbol": "a symbol", "true": "true", "unknown": "unknown", "void": "void", "undefined": "undefined"}

text​

NameTypeDescription
any anyany
bigint biginta bigint
boolean booleana boolean
false falsefalse
never nevernever
null nullnull
number numbera number
object objectan object
string stringa string
symbol symbola symbol
true truetrue
unknown unknownunknown
void voidvoid
undefined undefinedundefined
- + \ No newline at end of file diff --git a/docs/1.0.25-alpha/api/type/index.html b/docs/1.0.25-alpha/api/type/index.html index 2fadcae4dd..ece95622fe 100644 --- a/docs/1.0.25-alpha/api/type/index.html +++ b/docs/1.0.25-alpha/api/type/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.25-alpha

type

text​

type: TypeParser<PrecompiledDefaults>

hide_table_of_contents: true​

Type

text​

export type Type<t = unknown> = defer<Checker<t> & TypeRoot<t>>
- + \ No newline at end of file diff --git a/docs/1.0.25-alpha/api/union/index.html b/docs/1.0.25-alpha/api/union/index.html index 78d6179e82..913a395b4f 100644 --- a/docs/1.0.25-alpha/api/union/index.html +++ b/docs/1.0.25-alpha/api/union/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.25-alpha

union

operator​

string​

  • "L|R"
  • const union = type("string|number")

tuple​

  • [L, "|" , R]
  • const tupleUnion = type(["string", "|", "number"])

helper​

  • union(L,R)
  • const helperUnion = union("string", "number")
- + \ No newline at end of file diff --git a/docs/1.0.25-alpha/api/validatebound/index.html b/docs/1.0.25-alpha/api/validatebound/index.html index ebccdc16de..c54d3a5821 100644 --- a/docs/1.0.25-alpha/api/validatebound/index.html +++ b/docs/1.0.25-alpha/api/validatebound/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.25-alpha

validateBound

operator​

tableRow​

VariableDescription
Nnumber literal
Ssized data (a number, string or array)
<Comparator (one of <, <=, ==, >=, >)

description​

  • Bound operators allow data to be bounded in the format "S<N", or as a Range: "N<S<N", with comparators restricted to < or <=

string​

  • "N<S<N", with comparators restricted to < or <=
  • const range = type("2<=number<5")
  • const bound = type("string[]==5")
- + \ No newline at end of file diff --git a/docs/1.0.25-alpha/api/validatedefinition/index.html b/docs/1.0.25-alpha/api/validatedefinition/index.html index 7589466025..539bd668d0 100644 --- a/docs/1.0.25-alpha/api/validatedefinition/index.html +++ b/docs/1.0.25-alpha/api/validatedefinition/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.25-alpha

validateDefinition

text​

export type validateDefinition<def, $> = [def] extends [(...args: any[]) => any]
? def
: def extends Terminal
? def
: def extends string
? validateString<def, $>
: def extends TupleExpression
? validateTupleExpression<def, $>
: def extends BadDefinitionType
? writeBadDefinitionTypeMessage<
objectKindOf<def> extends string ? objectKindOf<def> : domainOf<def>
>
: isUnknown<def> extends true
? stringKeyOf<$>
: evaluate<{
[k in keyof def]: validateDefinition<def[k], $>
}>
- + \ No newline at end of file diff --git a/docs/1.0.25-alpha/api/validatedivisor/index.html b/docs/1.0.25-alpha/api/validatedivisor/index.html index 7aaca87ee8..6de7dcdf6f 100644 --- a/docs/1.0.25-alpha/api/validatedivisor/index.html +++ b/docs/1.0.25-alpha/api/validatedivisor/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.25-alpha

validateDivisor

operator​

string​

  • "N%D", where "N" is a number and "D" is a non-zero integer
- + \ No newline at end of file diff --git a/docs/1.0.25-alpha/api/validationscope/index.html b/docs/1.0.25-alpha/api/validationscope/index.html index 55715df795..04fd3c907e 100644 --- a/docs/1.0.25-alpha/api/validationscope/index.html +++ b/docs/1.0.25-alpha/api/validationscope/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.25-alpha

validationScope

keywords​

  • keywords: { "alpha": "only letters", "alphanumeric": "only letters and digits", "lowercase": "only lowercase letters", "uppercase": "only uppercase letters", "creditCard": "a valid credit card number", "email": "a valid email", "uuid": "a valid UUID", "parsedNumber": "a well-formed numeric string", "parsedInteger": "a well-formed integer string", "parsedDate": "a valid date", "semver": "a valid semantic version", "json": "a JSON-parsable string", "integer": "an integer"}

text​

NameTypeDescription
alpha stringonly letters
alphanumeric stringonly letters and digits
lowercase stringonly lowercase letters
uppercase stringonly uppercase letters
creditCard stringa valid credit card number
email stringa valid email
uuid stringa valid UUID
parsedNumber (In: string) => numbera well-formed numeric string
parsedInteger (In: string) => numbera well-formed integer string
parsedDate (In: string) => Datea valid date
semver stringa valid semantic version
json (In: string) => unknowna JSON-parsable string
integer numberan integer
- + \ No newline at end of file diff --git a/docs/1.0.25-alpha/api/valueof/index.html b/docs/1.0.25-alpha/api/valueof/index.html index c7fbeb07c5..b53b8d145f 100644 --- a/docs/1.0.25-alpha/api/valueof/index.html +++ b/docs/1.0.25-alpha/api/valueof/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.25-alpha

valueOf

operator​

tuple​

  • ["===", T]
  • const tupleValueOf = type(["valueOf", {a:"string"}])

helper​

  • valueOf(T)
  • const helperValueOf = valueOf({a:"string"})
- + \ No newline at end of file diff --git a/docs/1.0.25-alpha/index.html b/docs/1.0.25-alpha/index.html index 58e3a47432..91a409bbbf 100644 --- a/docs/1.0.25-alpha/index.html +++ b/docs/1.0.25-alpha/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.25-alpha

Getting Started

Install 📦12KB gzipped, 0 dependencies​

Npm Icon npm install arktype(or whatever package manager you prefer)

Our types are tested in strict-mode with TypeScript versions 4.8, 4.9, and 5.0.

Our APIs have mostly stabilized, but details may still change during the alpha/beta stages of our 1.0 release. If you have suggestions that may require a breaking change, now is the time to let us know! ⛵

Your first type​

- + \ No newline at end of file diff --git a/docs/1.0.25-alpha/scopes/index.html b/docs/1.0.25-alpha/scopes/index.html index 8954dee86a..fb3be1eb55 100644 --- a/docs/1.0.25-alpha/scopes/index.html +++ b/docs/1.0.25-alpha/scopes/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.25-alpha

Scopes

- + \ No newline at end of file diff --git a/docs/1.0.26-alpha/api/ark/index.html b/docs/1.0.26-alpha/api/ark/index.html index 5c59dd9157..1840c30cc6 100644 --- a/docs/1.0.26-alpha/api/ark/index.html +++ b/docs/1.0.26-alpha/api/ark/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.26-alpha

ark

text​

ark: Space<PrecompiledDefaults>
- + \ No newline at end of file diff --git a/docs/1.0.26-alpha/api/arkscope/index.html b/docs/1.0.26-alpha/api/arkscope/index.html index 8828e607a6..c5106c32f5 100644 --- a/docs/1.0.26-alpha/api/arkscope/index.html +++ b/docs/1.0.26-alpha/api/arkscope/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.26-alpha

arkScope

text​

arkScope: import("./scope.js").Scope<
[
{
any: any
bigint: bigint
boolean: boolean
false: false
never: never
null: null
number: number
object: object
string: string
symbol: symbol
true: true
unknown: unknown
void: void
undefined: undefined
Function: (...args: any[]) => unknown
Date: Date
Error: Error
Map: Map<unknown, unknown>
RegExp: RegExp
Set: Set<unknown>
WeakMap: WeakMap<object, unknown>
WeakSet: WeakSet<object>
Promise: Promise<unknown>
alpha: string
alphanumeric: string
lowercase: string
uppercase: string
creditCard: string
email: string
uuid: string
parsedNumber: (In: string) => number
parsedInteger: (In: string) => number
parsedDate: (In: string) => Date
semver: string
json: (In: string) => unknown
integer: number
},
{},
false
]
>
- + \ No newline at end of file diff --git a/docs/1.0.26-alpha/api/arrayof/index.html b/docs/1.0.26-alpha/api/arrayof/index.html index e4a73ce4fc..8a436521f7 100644 --- a/docs/1.0.26-alpha/api/arrayof/index.html +++ b/docs/1.0.26-alpha/api/arrayof/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.26-alpha

arrayOf

operator​

string​

  • "T[]"
  • const numberArray = type("number[]")

tuple​

  • [T, "[]"]
  • const tupleArray = type(["number", "[]"])

helper​

  • arrayOf(T)
  • const helperArray = arrayOf("number")
- + \ No newline at end of file diff --git a/docs/1.0.26-alpha/api/index.html b/docs/1.0.26-alpha/api/index.html index 13d3a4eab2..d9869622bb 100644 --- a/docs/1.0.26-alpha/api/index.html +++ b/docs/1.0.26-alpha/api/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.26-alpha

API

ArkType supports many of TypeScript's built-in types and operators, as well as some new ones dedicated exclusively to runtime validation. In fact, we got a little ahead of ourselves and built a ton of cool features, but we're still working on getting caught up syntax and API docs. Keep an eye out for more in the next couple weeks ⛵

In the meantime, check out the examples here and use the type hints you get to learn how you can customize your types and scopes. If you want to explore some of the more advanced features, take a look at our unit tests or ask us on Discord if your functionality is supported. If not, create a GitHub issue so we can prioritize it!

- + \ No newline at end of file diff --git a/docs/1.0.26-alpha/api/infer/index.html b/docs/1.0.26-alpha/api/infer/index.html index 7097a668d3..4a575d5225 100644 --- a/docs/1.0.26-alpha/api/infer/index.html +++ b/docs/1.0.26-alpha/api/infer/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.26-alpha

Infer

text​

export type Infer<t> = {
[as]?: t
}
- + \ No newline at end of file diff --git a/docs/1.0.26-alpha/api/inferdefinition/index.html b/docs/1.0.26-alpha/api/inferdefinition/index.html index 3aac6eaa37..ddb3b2cd44 100644 --- a/docs/1.0.26-alpha/api/inferdefinition/index.html +++ b/docs/1.0.26-alpha/api/inferdefinition/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.26-alpha

inferDefinition

text​

export type inferDefinition<def, $> = isAny<def> extends true
? never
: def extends Infer<infer t> | InferredThunk<infer t>
? t
: def extends string
? inferString<def, $>
: def extends List
? inferTuple<def, $>
: def extends RegExp
? string
: def extends Dict
? inferRecord<def, $>
: never
- + \ No newline at end of file diff --git a/docs/1.0.26-alpha/api/instanceof/index.html b/docs/1.0.26-alpha/api/instanceof/index.html index bdec8b816f..5ce1fb8e64 100644 --- a/docs/1.0.26-alpha/api/instanceof/index.html +++ b/docs/1.0.26-alpha/api/instanceof/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.26-alpha

instanceOf

operator​

tuple​

  • ["instanceOf", T]
  • const tupleInstanceOf = type(["instanceOf", Date])

helper​

  • instanceOf(T)
  • const helperInstanceOf = instanceOf(Date)
- + \ No newline at end of file diff --git a/docs/1.0.26-alpha/api/intersection/index.html b/docs/1.0.26-alpha/api/intersection/index.html index 09a28e5fb7..a0ec7cdbad 100644 --- a/docs/1.0.26-alpha/api/intersection/index.html +++ b/docs/1.0.26-alpha/api/intersection/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.26-alpha

intersection

operator​

string​

  • "L&R"
  • const intersection = type("/@arktype.io$/ & email")

tuple​

  • [L, "&", R]
  • const tupleIntersection = type(["/@arktype.io$/", "&", "email"])

helper​

  • intersection(L,R)
  • const helperIntersection = intersection("/@arktype.io$/","email")
- + \ No newline at end of file diff --git a/docs/1.0.26-alpha/api/jsobjectsscope/index.html b/docs/1.0.26-alpha/api/jsobjectsscope/index.html index f7b5ba98f3..b9a3edfc0e 100644 --- a/docs/1.0.26-alpha/api/jsobjectsscope/index.html +++ b/docs/1.0.26-alpha/api/jsobjectsscope/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.26-alpha

jsObjectsScope

text​

NameTypeDescription
Function (...args: any[]) => unknown
Date Date
Error Error
Map Map<unknown, unknown>
RegExp RegExp
Set Set<unknown>
WeakMap WeakMap<object, unknown>
WeakSet WeakSet<object>
Promise Promise<unknown>
- + \ No newline at end of file diff --git a/docs/1.0.26-alpha/api/keyof/index.html b/docs/1.0.26-alpha/api/keyof/index.html index 2cf97f96d9..c3468d9dda 100644 --- a/docs/1.0.26-alpha/api/keyof/index.html +++ b/docs/1.0.26-alpha/api/keyof/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.26-alpha

keyOf

operator​

tuple​

  • "["keyOf", T]"
  • const tupleKeyOf = type(["keyOf", {a:"string"}])

helper​

  • keyOf(T)
  • const helperKeyOf = keyOf({a:"string"})
- + \ No newline at end of file diff --git a/docs/1.0.26-alpha/api/keywords/index.html b/docs/1.0.26-alpha/api/keywords/index.html index 11e5e868e8..eba42cad6d 100644 --- a/docs/1.0.26-alpha/api/keywords/index.html +++ b/docs/1.0.26-alpha/api/keywords/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.26-alpha

Keywords

jsObjectsScope​

NameTypeDescription
Function (...args: any[]) => unknown
Date Date
Error Error
Map Map<unknown, unknown>
RegExp RegExp
Set Set<unknown>
WeakMap WeakMap<object, unknown>
WeakSet WeakSet<object>
Promise Promise<unknown>

tsKeywordsScope​

NameTypeDescription
any anyany
bigint biginta bigint
boolean booleana boolean
false falsefalse
never nevernever
null nullnull
number numbera number
object objectan object
string stringa string
symbol symbola symbol
true truetrue
unknown unknownunknown
void voidvoid
undefined undefinedundefined

validationScope​

NameTypeDescription
alpha stringonly letters
alphanumeric stringonly letters and digits
lowercase stringonly lowercase letters
uppercase stringonly uppercase letters
creditCard stringa valid credit card number
email stringa valid email
uuid stringa valid UUID
parsedNumber (In: string) => numbera well-formed numeric string
parsedInteger (In: string) => numbera well-formed integer string
parsedDate (In: string) => Datea valid date
semver stringa valid semantic version
json (In: string) => unknowna JSON-parsable string
integer numberan integer
- + \ No newline at end of file diff --git a/docs/1.0.26-alpha/api/morph/index.html b/docs/1.0.26-alpha/api/morph/index.html index 8fb2951684..b7c874e8f1 100644 --- a/docs/1.0.26-alpha/api/morph/index.html +++ b/docs/1.0.26-alpha/api/morph/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.26-alpha

morph

operator​

tuple​

  • [inputType, "|>", (data) => output]
  • const tupleMorph = type( ["string", "|>" , (data) => `morphed ${data}`])

helper​

  • morph(inputType, (data) => output)
  • const helperMorph = morph("string", (data) => `morphed ${data}`)
- + \ No newline at end of file diff --git a/docs/1.0.26-alpha/api/narrow/index.html b/docs/1.0.26-alpha/api/narrow/index.html index ba3896494a..b65f3cad2d 100644 --- a/docs/1.0.26-alpha/api/narrow/index.html +++ b/docs/1.0.26-alpha/api/narrow/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.26-alpha

narrow

operator​

tuple​

  • ["type", "=>" , condition]
  • const narrow = type( ["number", "=>" , (n) => n % 2 === 0])

example​

  •      const isEven = (x: unknown): x is number => x % 2 === 0
- + \ No newline at end of file diff --git a/docs/1.0.26-alpha/api/operators/index.html b/docs/1.0.26-alpha/api/operators/index.html index b30bfd0fb8..cae8c3b6dc 100644 --- a/docs/1.0.26-alpha/api/operators/index.html +++ b/docs/1.0.26-alpha/api/operators/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.26-alpha

Operators

Operating Table​

operatorstringtuplehelper
arrayOf"T[]"[T, "[]"]arrayOf(T)
instanceOf["instanceOf", T]instanceOf(T)
&"L&R"[L, "&", R]intersection(L,R)
keyOf"["keyOf", T]"keyOf(T)
|>[inputType, "|>", (data) => output]morph(inputType, (data) => output)
=>["type", "=>" , condition]
|"L|R"[L, "|" , R]union(L,R)
===["===", T]valueOf(T)
:["type", ":", config]
bound"N<S<N", with comparators restricted to < or <=
%"N%D", where "N" is a number and "D" is a non-zero integer
node["node", nodeDefinition]type.from(nodeDefinition)
- + \ No newline at end of file diff --git a/docs/1.0.26-alpha/api/parseconfigtuple/index.html b/docs/1.0.26-alpha/api/parseconfigtuple/index.html index c71e2a780a..bc2049f68e 100644 --- a/docs/1.0.26-alpha/api/parseconfigtuple/index.html +++ b/docs/1.0.26-alpha/api/parseconfigtuple/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.26-alpha

parseConfigTuple

operator​

tuple​

  • ["type", ":", config]
- + \ No newline at end of file diff --git a/docs/1.0.26-alpha/api/precompileddefaults/index.html b/docs/1.0.26-alpha/api/precompileddefaults/index.html index 852d7b2ea1..d248a69184 100644 --- a/docs/1.0.26-alpha/api/precompileddefaults/index.html +++ b/docs/1.0.26-alpha/api/precompileddefaults/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.26-alpha

PrecompiledDefaults

text​

export type PrecompiledDefaults = {
any: any
bigint: bigint
boolean: boolean
false: false
never: never
null: null
number: number
object: object
string: string
symbol: symbol
true: true
unknown: unknown
void: void
undefined: undefined
integer: number
alpha: string
alphanumeric: string
lowercase: string
uppercase: string
creditCard: string
email: string
uuid: string
semver: string
json: (In: string) => unknown
parsedNumber: (In: string) => number
parsedInteger: (In: string) => number
parsedDate: (In: string) => Date
Function: (...args: any[]) => unknown
Date: Date
Error: Error
Map: Map<unknown, unknown>
RegExp: RegExp
Set: Set<unknown>
WeakMap: WeakMap<object, unknown>
WeakSet: WeakSet<object>
Promise: Promise<unknown>
}
- + \ No newline at end of file diff --git a/docs/1.0.26-alpha/api/problem/index.html b/docs/1.0.26-alpha/api/problem/index.html index 21050bb1db..359250485f 100644 --- a/docs/1.0.26-alpha/api/problem/index.html +++ b/docs/1.0.26-alpha/api/problem/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.26-alpha

Problem

text​

export declare class Problem<code extends ProblemCode = ProblemCode> {
code: code
path: Path
private data
private source
private writers
parts?: Problem[]
constructor(
code: code,
path: Path,
data: ProblemData<code>,
source: ProblemSource<code>,
writers: ProblemWriters<code>
)
toString(): string
get message(): string
get reason(): string
get mustBe(): string
}
- + \ No newline at end of file diff --git a/docs/1.0.26-alpha/api/problems/index.html b/docs/1.0.26-alpha/api/problems/index.html index fe84c30e27..86c5190c8b 100644 --- a/docs/1.0.26-alpha/api/problems/index.html +++ b/docs/1.0.26-alpha/api/problems/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.26-alpha

Problems

text​

Problems: new (state: TraversalState) => Problems
export type Problems = arraySubclassToReadonly<ProblemArray>;
- + \ No newline at end of file diff --git a/docs/1.0.26-alpha/api/resolvednode/index.html b/docs/1.0.26-alpha/api/resolvednode/index.html index cccbe2b0dc..9755dd1c27 100644 --- a/docs/1.0.26-alpha/api/resolvednode/index.html +++ b/docs/1.0.26-alpha/api/resolvednode/index.html @@ -7,13 +7,13 @@ - +
- + \ No newline at end of file diff --git a/docs/1.0.26-alpha/api/scope/index.html b/docs/1.0.26-alpha/api/scope/index.html index 5854d19d32..f9bfa98d3d 100644 --- a/docs/1.0.26-alpha/api/scope/index.html +++ b/docs/1.0.26-alpha/api/scope/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.26-alpha

scope

text​

scope: ScopeParser

hide_table_of_contents: true​

Scope

text​

export declare class Scope<context extends ScopeContext = any> {
#private
aliases: Dict
name: string
config: ScopeConfig
parseCache: FreezingCache<Node>
constructor(aliases: Dict, opts?: ScopeOptions)
getAnonymousQualifiedName(base: AnonymousTypeName): QualifiedTypeName
addAnonymousTypeReference(referencedType: Type, ctx: ParseContext): Node
get infer(): exportsOf<context>
compile(): Space<exportsOf<context>>
addParsedReferenceIfResolvable(
name: name<context>,
ctx: ParseContext
): boolean
resolve(name: name<context>): Type
resolveNode(node: Node): ResolvedNode
resolveTypeNode(node: Node): TypeNode
expressions: Expressions<resolutions<context>>
intersection: import("./expressions.js").BinaryExpressionParser<
resolutions<context>,
"&"
>
union: import("./expressions.js").BinaryExpressionParser<
resolutions<context>,
"|"
>
arrayOf: import("./expressions.js").UnaryExpressionParser<
resolutions<context>,
"[]"
>
keyOf: import("./expressions.js").UnaryExpressionParser<
resolutions<context>,
"keyof"
>
valueOf: import("./expressions.js").UnvalidatedExpressionParser<
resolutions<context>,
"==="
>
instanceOf: import("./expressions.js").UnvalidatedExpressionParser<
resolutions<context>,
"instanceof"
>
narrow: import("./expressions.js").FunctionalExpressionParser<
resolutions<context>,
"=>"
>
morph: import("./expressions.js").FunctionalExpressionParser<
resolutions<context>,
"|>"
>
type: TypeParser<resolutions<context>>
isResolvable(name: string): unknown
}
- + \ No newline at end of file diff --git a/docs/1.0.26-alpha/api/space/index.html b/docs/1.0.26-alpha/api/space/index.html index ae91326ad2..c0b592ba10 100644 --- a/docs/1.0.26-alpha/api/space/index.html +++ b/docs/1.0.26-alpha/api/space/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.26-alpha

Space

text​

export type Space<exports = Dict> = {
[k in keyof exports]: Type<exports[k]>
}
- + \ No newline at end of file diff --git a/docs/1.0.26-alpha/api/tskeywordsscope/index.html b/docs/1.0.26-alpha/api/tskeywordsscope/index.html index 9599b866a7..0f19aeb5b5 100644 --- a/docs/1.0.26-alpha/api/tskeywordsscope/index.html +++ b/docs/1.0.26-alpha/api/tskeywordsscope/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.26-alpha

tsKeywordsScope

keywords​

  • keywords: {"any": "any", "bigint": "a bigint", "boolean": "a boolean", "false": "false", "never": "never", "null": "null", "number": "a number", "object": "an object", "string": "a string", "symbol": "a symbol", "true": "true", "unknown": "unknown", "void": "void", "undefined": "undefined"}

text​

NameTypeDescription
any anyany
bigint biginta bigint
boolean booleana boolean
false falsefalse
never nevernever
null nullnull
number numbera number
object objectan object
string stringa string
symbol symbola symbol
true truetrue
unknown unknownunknown
void voidvoid
undefined undefinedundefined
- + \ No newline at end of file diff --git a/docs/1.0.26-alpha/api/type/index.html b/docs/1.0.26-alpha/api/type/index.html index 97ebf91838..c24fcf750f 100644 --- a/docs/1.0.26-alpha/api/type/index.html +++ b/docs/1.0.26-alpha/api/type/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.26-alpha

type

text​

type: TypeParser<PrecompiledDefaults>

hide_table_of_contents: true​

Type

text​

export type Type<t = unknown> = defer<Checker<t> & TypeRoot<t>>
- + \ No newline at end of file diff --git a/docs/1.0.26-alpha/api/union/index.html b/docs/1.0.26-alpha/api/union/index.html index c73952b0cf..1385877e54 100644 --- a/docs/1.0.26-alpha/api/union/index.html +++ b/docs/1.0.26-alpha/api/union/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.26-alpha

union

operator​

string​

  • "L|R"
  • const union = type("string|number")

tuple​

  • [L, "|" , R]
  • const tupleUnion = type(["string", "|", "number"])

helper​

  • union(L,R)
  • const helperUnion = union("string", "number")
- + \ No newline at end of file diff --git a/docs/1.0.26-alpha/api/validatebound/index.html b/docs/1.0.26-alpha/api/validatebound/index.html index 79a69245a9..3bdf602515 100644 --- a/docs/1.0.26-alpha/api/validatebound/index.html +++ b/docs/1.0.26-alpha/api/validatebound/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.26-alpha

validateBound

operator​

tableRow​

VariableDescription
Nnumber literal
Ssized data (a number, string or array)
<Comparator (one of <, <=, ==, >=, >)

description​

  • Bound operators allow data to be bounded in the format "S<N", or as a Range: "N<S<N", with comparators restricted to < or <=

string​

  • "N<S<N", with comparators restricted to < or <=
  • const range = type("2<=number<5")
  • const bound = type("string[]==5")
- + \ No newline at end of file diff --git a/docs/1.0.26-alpha/api/validatedefinition/index.html b/docs/1.0.26-alpha/api/validatedefinition/index.html index 221610617a..6d030385cc 100644 --- a/docs/1.0.26-alpha/api/validatedefinition/index.html +++ b/docs/1.0.26-alpha/api/validatedefinition/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.26-alpha

validateDefinition

text​

export type validateDefinition<def, $> = [def] extends [(...args: any[]) => any]
? def
: def extends Terminal
? def
: def extends string
? validateString<def, $>
: def extends TupleExpression
? validateTupleExpression<def, $>
: def extends BadDefinitionType
? writeBadDefinitionTypeMessage<
objectKindOf<def> extends string ? objectKindOf<def> : domainOf<def>
>
: isUnknown<def> extends true
? stringKeyOf<$>
: evaluate<{
[k in keyof def]: validateDefinition<def[k], $>
}>
- + \ No newline at end of file diff --git a/docs/1.0.26-alpha/api/validatedivisor/index.html b/docs/1.0.26-alpha/api/validatedivisor/index.html index c2aea9e101..b056a612df 100644 --- a/docs/1.0.26-alpha/api/validatedivisor/index.html +++ b/docs/1.0.26-alpha/api/validatedivisor/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.26-alpha

validateDivisor

operator​

string​

  • "N%D", where "N" is a number and "D" is a non-zero integer
- + \ No newline at end of file diff --git a/docs/1.0.26-alpha/api/validationscope/index.html b/docs/1.0.26-alpha/api/validationscope/index.html index bfe270f46c..1c724401a6 100644 --- a/docs/1.0.26-alpha/api/validationscope/index.html +++ b/docs/1.0.26-alpha/api/validationscope/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.26-alpha

validationScope

keywords​

  • keywords: { "alpha": "only letters", "alphanumeric": "only letters and digits", "lowercase": "only lowercase letters", "uppercase": "only uppercase letters", "creditCard": "a valid credit card number", "email": "a valid email", "uuid": "a valid UUID", "parsedNumber": "a well-formed numeric string", "parsedInteger": "a well-formed integer string", "parsedDate": "a valid date", "semver": "a valid semantic version", "json": "a JSON-parsable string", "integer": "an integer"}

text​

NameTypeDescription
alpha stringonly letters
alphanumeric stringonly letters and digits
lowercase stringonly lowercase letters
uppercase stringonly uppercase letters
creditCard stringa valid credit card number
email stringa valid email
uuid stringa valid UUID
parsedNumber (In: string) => numbera well-formed numeric string
parsedInteger (In: string) => numbera well-formed integer string
parsedDate (In: string) => Datea valid date
semver stringa valid semantic version
json (In: string) => unknowna JSON-parsable string
integer numberan integer
- + \ No newline at end of file diff --git a/docs/1.0.26-alpha/api/valueof/index.html b/docs/1.0.26-alpha/api/valueof/index.html index a478221ed0..b46a595307 100644 --- a/docs/1.0.26-alpha/api/valueof/index.html +++ b/docs/1.0.26-alpha/api/valueof/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.26-alpha

valueOf

operator​

tuple​

  • ["===", T]
  • const tupleValueOf = type(["valueOf", {a:"string"}])

helper​

  • valueOf(T)
  • const helperValueOf = valueOf({a:"string"})
- + \ No newline at end of file diff --git a/docs/1.0.26-alpha/index.html b/docs/1.0.26-alpha/index.html index 7fd9a5618c..fa81db5942 100644 --- a/docs/1.0.26-alpha/index.html +++ b/docs/1.0.26-alpha/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.26-alpha

Getting Started

Install 📦12KB gzipped, 0 dependencies​

Npm Icon npm install arktype(or whatever package manager you prefer)

Our types are tested in strict-mode with TypeScript versions 4.8, 4.9, and 5.0.

Our APIs have mostly stabilized, but details may still change during the alpha/beta stages of our 1.0 release. If you have suggestions that may require a breaking change, now is the time to let us know! ⛵

Your first type​

- + \ No newline at end of file diff --git a/docs/1.0.26-alpha/scopes/index.html b/docs/1.0.26-alpha/scopes/index.html index 3673b6c81c..2a4db66d63 100644 --- a/docs/1.0.26-alpha/scopes/index.html +++ b/docs/1.0.26-alpha/scopes/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.26-alpha

Scopes

- + \ No newline at end of file diff --git a/docs/1.0.27-alpha/api/ark/index.html b/docs/1.0.27-alpha/api/ark/index.html index fc3f76849d..1210d4e12f 100644 --- a/docs/1.0.27-alpha/api/ark/index.html +++ b/docs/1.0.27-alpha/api/ark/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.27-alpha

ark

text​

ark: Space<PrecompiledDefaults>
- + \ No newline at end of file diff --git a/docs/1.0.27-alpha/api/arkscope/index.html b/docs/1.0.27-alpha/api/arkscope/index.html index 0f9002b6b6..84f07dbf33 100644 --- a/docs/1.0.27-alpha/api/arkscope/index.html +++ b/docs/1.0.27-alpha/api/arkscope/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.27-alpha

arkScope

text​

arkScope: import("./scope.js").Scope<
[
{
any: any
bigint: bigint
boolean: boolean
false: false
never: never
null: null
number: number
object: object
string: string
symbol: symbol
true: true
unknown: unknown
void: void
undefined: undefined
Function: (...args: any[]) => unknown
Date: Date
Error: Error
Map: Map<unknown, unknown>
RegExp: RegExp
Set: Set<unknown>
WeakMap: WeakMap<object, unknown>
WeakSet: WeakSet<object>
Promise: Promise<unknown>
alpha: string
alphanumeric: string
lowercase: string
uppercase: string
creditCard: string
email: string
uuid: string
parsedNumber: (In: string) => number
parsedInteger: (In: string) => number
parsedDate: (In: string) => Date
semver: string
json: (In: string) => unknown
integer: number
},
{},
false
]
>
- + \ No newline at end of file diff --git a/docs/1.0.27-alpha/api/arrayof/index.html b/docs/1.0.27-alpha/api/arrayof/index.html index f1ef4f3869..ddf4dbc54a 100644 --- a/docs/1.0.27-alpha/api/arrayof/index.html +++ b/docs/1.0.27-alpha/api/arrayof/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.27-alpha

arrayOf

operator​

string​

  • "T[]"
  • const numberArray = type("number[]")

tuple​

  • [T, "[]"]
  • const tupleArray = type(["number", "[]"])

helper​

  • arrayOf(T)
  • const helperArray = arrayOf("number")
- + \ No newline at end of file diff --git a/docs/1.0.27-alpha/api/index.html b/docs/1.0.27-alpha/api/index.html index 7eba0da9d5..ea4d91f6ba 100644 --- a/docs/1.0.27-alpha/api/index.html +++ b/docs/1.0.27-alpha/api/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.27-alpha

API

ArkType supports many of TypeScript's built-in types and operators, as well as some new ones dedicated exclusively to runtime validation. In fact, we got a little ahead of ourselves and built a ton of cool features, but we're still working on getting caught up syntax and API docs. Keep an eye out for more in the next couple weeks ⛵

In the meantime, check out the examples here and use the type hints you get to learn how you can customize your types and scopes. If you want to explore some of the more advanced features, take a look at our unit tests or ask us on Discord if your functionality is supported. If not, create a GitHub issue so we can prioritize it!

- + \ No newline at end of file diff --git a/docs/1.0.27-alpha/api/infer/index.html b/docs/1.0.27-alpha/api/infer/index.html index 417d357113..82bf626101 100644 --- a/docs/1.0.27-alpha/api/infer/index.html +++ b/docs/1.0.27-alpha/api/infer/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.27-alpha

Infer

text​

export type Infer<t> = {
[as]?: t
}
- + \ No newline at end of file diff --git a/docs/1.0.27-alpha/api/inferdefinition/index.html b/docs/1.0.27-alpha/api/inferdefinition/index.html index b4c8fb0464..4a238775eb 100644 --- a/docs/1.0.27-alpha/api/inferdefinition/index.html +++ b/docs/1.0.27-alpha/api/inferdefinition/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.27-alpha

inferDefinition

text​

export type inferDefinition<def, $> = isAny<def> extends true
? never
: def extends Infer<infer t> | InferredThunk<infer t>
? t
: def extends string
? inferString<def, $>
: def extends List
? inferTuple<def, $>
: def extends RegExp
? string
: def extends Dict
? inferRecord<def, $>
: never
- + \ No newline at end of file diff --git a/docs/1.0.27-alpha/api/instanceof/index.html b/docs/1.0.27-alpha/api/instanceof/index.html index 3d898c3171..168b7b31e5 100644 --- a/docs/1.0.27-alpha/api/instanceof/index.html +++ b/docs/1.0.27-alpha/api/instanceof/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.27-alpha

instanceOf

operator​

tuple​

  • ["instanceOf", T]
  • const tupleInstanceOf = type(["instanceOf", Date])

helper​

  • instanceOf(T)
  • const helperInstanceOf = instanceOf(Date)
- + \ No newline at end of file diff --git a/docs/1.0.27-alpha/api/intersection/index.html b/docs/1.0.27-alpha/api/intersection/index.html index f9b0ada79b..6f48c61025 100644 --- a/docs/1.0.27-alpha/api/intersection/index.html +++ b/docs/1.0.27-alpha/api/intersection/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.27-alpha

intersection

operator​

string​

  • "L&R"
  • const intersection = type("/@arktype.io$/ & email")

tuple​

  • [L, "&", R]
  • const tupleIntersection = type(["/@arktype.io$/", "&", "email"])

helper​

  • intersection(L,R)
  • const helperIntersection = intersection("/@arktype.io$/","email")
- + \ No newline at end of file diff --git a/docs/1.0.27-alpha/api/jsobjectsscope/index.html b/docs/1.0.27-alpha/api/jsobjectsscope/index.html index 7185af8f6b..62e4c3cc45 100644 --- a/docs/1.0.27-alpha/api/jsobjectsscope/index.html +++ b/docs/1.0.27-alpha/api/jsobjectsscope/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.27-alpha

jsObjectsScope

text​

NameTypeDescription
Function (...args: any[]) => unknown
Date Date
Error Error
Map Map<unknown, unknown>
RegExp RegExp
Set Set<unknown>
WeakMap WeakMap<object, unknown>
WeakSet WeakSet<object>
Promise Promise<unknown>
- + \ No newline at end of file diff --git a/docs/1.0.27-alpha/api/keyof/index.html b/docs/1.0.27-alpha/api/keyof/index.html index 11311110ca..5ca19ed83a 100644 --- a/docs/1.0.27-alpha/api/keyof/index.html +++ b/docs/1.0.27-alpha/api/keyof/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.27-alpha

keyOf

operator​

tuple​

  • "["keyOf", T]"
  • const tupleKeyOf = type(["keyOf", {a:"string"}])

helper​

  • keyOf(T)
  • const helperKeyOf = keyOf({a:"string"})
- + \ No newline at end of file diff --git a/docs/1.0.27-alpha/api/keywords/index.html b/docs/1.0.27-alpha/api/keywords/index.html index 1f81815b31..921bae03a1 100644 --- a/docs/1.0.27-alpha/api/keywords/index.html +++ b/docs/1.0.27-alpha/api/keywords/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.27-alpha

Keywords

jsObjectsScope​

NameTypeDescription
Function (...args: any[]) => unknown
Date Date
Error Error
Map Map<unknown, unknown>
RegExp RegExp
Set Set<unknown>
WeakMap WeakMap<object, unknown>
WeakSet WeakSet<object>
Promise Promise<unknown>

tsKeywordsScope​

NameTypeDescription
any anyany
bigint biginta bigint
boolean booleana boolean
false falsefalse
never nevernever
null nullnull
number numbera number
object objectan object
string stringa string
symbol symbola symbol
true truetrue
unknown unknownunknown
void voidvoid
undefined undefinedundefined

validationScope​

NameTypeDescription
alpha stringonly letters
alphanumeric stringonly letters and digits
lowercase stringonly lowercase letters
uppercase stringonly uppercase letters
creditCard stringa valid credit card number
email stringa valid email
uuid stringa valid UUID
parsedNumber (In: string) => numbera well-formed numeric string
parsedInteger (In: string) => numbera well-formed integer string
parsedDate (In: string) => Datea valid date
semver stringa valid semantic version
json (In: string) => unknowna JSON-parsable string
integer numberan integer
- + \ No newline at end of file diff --git a/docs/1.0.27-alpha/api/morph/index.html b/docs/1.0.27-alpha/api/morph/index.html index 9f1509461e..71357c629e 100644 --- a/docs/1.0.27-alpha/api/morph/index.html +++ b/docs/1.0.27-alpha/api/morph/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.27-alpha

morph

operator​

tuple​

  • [inputType, "|>", (data) => output]
  • const tupleMorph = type( ["string", "|>" , (data) => `morphed ${data}`])

helper​

  • morph(inputType, (data) => output)
  • const helperMorph = morph("string", (data) => `morphed ${data}`)
- + \ No newline at end of file diff --git a/docs/1.0.27-alpha/api/narrow/index.html b/docs/1.0.27-alpha/api/narrow/index.html index 9ba5d26eb0..6524500c07 100644 --- a/docs/1.0.27-alpha/api/narrow/index.html +++ b/docs/1.0.27-alpha/api/narrow/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.27-alpha

narrow

operator​

tuple​

  • ["type", "=>" , condition]
  • const narrow = type( ["number", "=>" , (n) => n % 2 === 0])

example​

  •      const isEven = (x: unknown): x is number => x % 2 === 0
- + \ No newline at end of file diff --git a/docs/1.0.27-alpha/api/operators/index.html b/docs/1.0.27-alpha/api/operators/index.html index 4cc6606fac..e64052d12b 100644 --- a/docs/1.0.27-alpha/api/operators/index.html +++ b/docs/1.0.27-alpha/api/operators/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.27-alpha

Operators

Operating Table​

operatorstringtuplehelper
arrayOf"T[]"[T, "[]"]arrayOf(T)
instanceOf["instanceOf", T]instanceOf(T)
&"L&R"[L, "&", R]intersection(L,R)
keyOf"["keyOf", T]"keyOf(T)
|>[inputType, "|>", (data) => output]morph(inputType, (data) => output)
=>["type", "=>" , condition]
|"L|R"[L, "|" , R]union(L,R)
===["===", T]valueOf(T)
:["type", ":", config]
bound"N<S<N", with comparators restricted to < or <=
%"N%D", where "N" is a number and "D" is a non-zero integer
node["node", nodeDefinition]type.from(nodeDefinition)
- + \ No newline at end of file diff --git a/docs/1.0.27-alpha/api/parseconfigtuple/index.html b/docs/1.0.27-alpha/api/parseconfigtuple/index.html index 52bd8294ce..b5cd039350 100644 --- a/docs/1.0.27-alpha/api/parseconfigtuple/index.html +++ b/docs/1.0.27-alpha/api/parseconfigtuple/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.27-alpha

parseConfigTuple

operator​

tuple​

  • ["type", ":", config]
- + \ No newline at end of file diff --git a/docs/1.0.27-alpha/api/precompileddefaults/index.html b/docs/1.0.27-alpha/api/precompileddefaults/index.html index 773515af1d..904e276511 100644 --- a/docs/1.0.27-alpha/api/precompileddefaults/index.html +++ b/docs/1.0.27-alpha/api/precompileddefaults/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.27-alpha

PrecompiledDefaults

text​

export type PrecompiledDefaults = {
any: any
bigint: bigint
boolean: boolean
false: false
never: never
null: null
number: number
object: object
string: string
symbol: symbol
true: true
unknown: unknown
void: void
undefined: undefined
integer: number
alpha: string
alphanumeric: string
lowercase: string
uppercase: string
creditCard: string
email: string
uuid: string
semver: string
json: (In: string) => unknown
parsedNumber: (In: string) => number
parsedInteger: (In: string) => number
parsedDate: (In: string) => Date
Function: (...args: any[]) => unknown
Date: Date
Error: Error
Map: Map<unknown, unknown>
RegExp: RegExp
Set: Set<unknown>
WeakMap: WeakMap<object, unknown>
WeakSet: WeakSet<object>
Promise: Promise<unknown>
}
- + \ No newline at end of file diff --git a/docs/1.0.27-alpha/api/problem/index.html b/docs/1.0.27-alpha/api/problem/index.html index ef4ac7d46a..1daf32eb42 100644 --- a/docs/1.0.27-alpha/api/problem/index.html +++ b/docs/1.0.27-alpha/api/problem/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.27-alpha

Problem

text​

export declare class Problem<code extends ProblemCode = ProblemCode> {
code: code
path: Path
private data
private source
private writers
parts?: Problem[]
constructor(
code: code,
path: Path,
data: ProblemData<code>,
source: ProblemSource<code>,
writers: ProblemWriters<code>
)
toString(): string
get message(): string
get reason(): string
get mustBe(): string
}
- + \ No newline at end of file diff --git a/docs/1.0.27-alpha/api/problems/index.html b/docs/1.0.27-alpha/api/problems/index.html index ed87ab37d6..99251f4603 100644 --- a/docs/1.0.27-alpha/api/problems/index.html +++ b/docs/1.0.27-alpha/api/problems/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.27-alpha

Problems

text​

Problems: new (state: TraversalState) => Problems
export type Problems = arraySubclassToReadonly<ProblemArray>;
- + \ No newline at end of file diff --git a/docs/1.0.27-alpha/api/resolvednode/index.html b/docs/1.0.27-alpha/api/resolvednode/index.html index f311bae944..b66acf6021 100644 --- a/docs/1.0.27-alpha/api/resolvednode/index.html +++ b/docs/1.0.27-alpha/api/resolvednode/index.html @@ -7,13 +7,13 @@ - +
- + \ No newline at end of file diff --git a/docs/1.0.27-alpha/api/scope/index.html b/docs/1.0.27-alpha/api/scope/index.html index d98a7069dd..3268734182 100644 --- a/docs/1.0.27-alpha/api/scope/index.html +++ b/docs/1.0.27-alpha/api/scope/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.27-alpha

scope

text​

scope: ScopeParser

hide_table_of_contents: true​

Scope

text​

export declare class Scope<context extends ScopeContext = any> {
#private
aliases: Dict
name: string
config: ScopeConfig
parseCache: FreezingCache<Node>
constructor(aliases: Dict, opts?: ScopeOptions)
getAnonymousQualifiedName(base: AnonymousTypeName): QualifiedTypeName
addAnonymousTypeReference(referencedType: Type, ctx: ParseContext): Node
get infer(): exportsOf<context>
compile(): Space<exportsOf<context>>
addParsedReferenceIfResolvable(
name: name<context>,
ctx: ParseContext
): boolean
resolve(name: name<context>): Type
resolveNode(node: Node): ResolvedNode
resolveTypeNode(node: Node): TypeNode
expressions: Expressions<resolutions<context>>
intersection: import("./expressions.js").BinaryExpressionParser<
resolutions<context>,
"&"
>
union: import("./expressions.js").BinaryExpressionParser<
resolutions<context>,
"|"
>
arrayOf: import("./expressions.js").UnaryExpressionParser<
resolutions<context>,
"[]"
>
keyOf: import("./expressions.js").UnaryExpressionParser<
resolutions<context>,
"keyof"
>
valueOf: import("./expressions.js").UnvalidatedExpressionParser<
resolutions<context>,
"==="
>
instanceOf: import("./expressions.js").UnvalidatedExpressionParser<
resolutions<context>,
"instanceof"
>
narrow: import("./expressions.js").FunctionalExpressionParser<
resolutions<context>,
"=>"
>
morph: import("./expressions.js").FunctionalExpressionParser<
resolutions<context>,
"|>"
>
type: TypeParser<resolutions<context>>
isResolvable(name: string): unknown
}
- + \ No newline at end of file diff --git a/docs/1.0.27-alpha/api/space/index.html b/docs/1.0.27-alpha/api/space/index.html index 5b955fc676..70a3ebe4bc 100644 --- a/docs/1.0.27-alpha/api/space/index.html +++ b/docs/1.0.27-alpha/api/space/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.27-alpha

Space

text​

export type Space<exports = Dict> = {
[k in keyof exports]: Type<exports[k]>
}
- + \ No newline at end of file diff --git a/docs/1.0.27-alpha/api/tskeywordsscope/index.html b/docs/1.0.27-alpha/api/tskeywordsscope/index.html index 2029e716bf..a27ba2f531 100644 --- a/docs/1.0.27-alpha/api/tskeywordsscope/index.html +++ b/docs/1.0.27-alpha/api/tskeywordsscope/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.27-alpha

tsKeywordsScope

keywords​

  • keywords: {"any": "any", "bigint": "a bigint", "boolean": "a boolean", "false": "false", "never": "never", "null": "null", "number": "a number", "object": "an object", "string": "a string", "symbol": "a symbol", "true": "true", "unknown": "unknown", "void": "void", "undefined": "undefined"}

text​

NameTypeDescription
any anyany
bigint biginta bigint
boolean booleana boolean
false falsefalse
never nevernever
null nullnull
number numbera number
object objectan object
string stringa string
symbol symbola symbol
true truetrue
unknown unknownunknown
void voidvoid
undefined undefinedundefined
- + \ No newline at end of file diff --git a/docs/1.0.27-alpha/api/type/index.html b/docs/1.0.27-alpha/api/type/index.html index e48d6d3f90..af1ecc070c 100644 --- a/docs/1.0.27-alpha/api/type/index.html +++ b/docs/1.0.27-alpha/api/type/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.27-alpha

type

text​

type: TypeParser<PrecompiledDefaults>

hide_table_of_contents: true​

Type

text​

export type Type<t = unknown> = defer<Checker<t> & TypeRoot<t>>
- + \ No newline at end of file diff --git a/docs/1.0.27-alpha/api/union/index.html b/docs/1.0.27-alpha/api/union/index.html index 3ac84c7a74..2561313872 100644 --- a/docs/1.0.27-alpha/api/union/index.html +++ b/docs/1.0.27-alpha/api/union/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.27-alpha

union

operator​

string​

  • "L|R"
  • const union = type("string|number")

tuple​

  • [L, "|" , R]
  • const tupleUnion = type(["string", "|", "number"])

helper​

  • union(L,R)
  • const helperUnion = union("string", "number")
- + \ No newline at end of file diff --git a/docs/1.0.27-alpha/api/validatebound/index.html b/docs/1.0.27-alpha/api/validatebound/index.html index ede30e92ec..949f3adcd4 100644 --- a/docs/1.0.27-alpha/api/validatebound/index.html +++ b/docs/1.0.27-alpha/api/validatebound/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.27-alpha

validateBound

operator​

tableRow​

VariableDescription
Nnumber literal
Ssized data (a number, string or array)
<Comparator (one of <, <=, ==, >=, >)

description​

  • Bound operators allow data to be bounded in the format "S<N", or as a Range: "N<S<N", with comparators restricted to < or <=

string​

  • "N<S<N", with comparators restricted to < or <=
  • const range = type("2<=number<5")
  • const bound = type("string[]==5")
- + \ No newline at end of file diff --git a/docs/1.0.27-alpha/api/validatedefinition/index.html b/docs/1.0.27-alpha/api/validatedefinition/index.html index 855c217e4f..7d832a45d1 100644 --- a/docs/1.0.27-alpha/api/validatedefinition/index.html +++ b/docs/1.0.27-alpha/api/validatedefinition/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.27-alpha

validateDefinition

text​

export type validateDefinition<def, $> = [def] extends [(...args: any[]) => any]
? def
: def extends Terminal
? def
: def extends string
? validateString<def, $>
: def extends TupleExpression
? validateTupleExpression<def, $>
: def extends BadDefinitionType
? writeBadDefinitionTypeMessage<
objectKindOf<def> extends string ? objectKindOf<def> : domainOf<def>
>
: isUnknown<def> extends true
? stringKeyOf<$>
: evaluate<{
[k in keyof def]: validateDefinition<def[k], $>
}>
- + \ No newline at end of file diff --git a/docs/1.0.27-alpha/api/validatedivisor/index.html b/docs/1.0.27-alpha/api/validatedivisor/index.html index da12f84ea7..6b5831534e 100644 --- a/docs/1.0.27-alpha/api/validatedivisor/index.html +++ b/docs/1.0.27-alpha/api/validatedivisor/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.27-alpha

validateDivisor

operator​

string​

  • "N%D", where "N" is a number and "D" is a non-zero integer
- + \ No newline at end of file diff --git a/docs/1.0.27-alpha/api/validationscope/index.html b/docs/1.0.27-alpha/api/validationscope/index.html index 7158addc5c..3555e813eb 100644 --- a/docs/1.0.27-alpha/api/validationscope/index.html +++ b/docs/1.0.27-alpha/api/validationscope/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.27-alpha

validationScope

keywords​

  • keywords: { "alpha": "only letters", "alphanumeric": "only letters and digits", "lowercase": "only lowercase letters", "uppercase": "only uppercase letters", "creditCard": "a valid credit card number", "email": "a valid email", "uuid": "a valid UUID", "parsedNumber": "a well-formed numeric string", "parsedInteger": "a well-formed integer string", "parsedDate": "a valid date", "semver": "a valid semantic version", "json": "a JSON-parsable string", "integer": "an integer"}

text​

NameTypeDescription
alpha stringonly letters
alphanumeric stringonly letters and digits
lowercase stringonly lowercase letters
uppercase stringonly uppercase letters
creditCard stringa valid credit card number
email stringa valid email
uuid stringa valid UUID
parsedNumber (In: string) => numbera well-formed numeric string
parsedInteger (In: string) => numbera well-formed integer string
parsedDate (In: string) => Datea valid date
semver stringa valid semantic version
json (In: string) => unknowna JSON-parsable string
integer numberan integer
- + \ No newline at end of file diff --git a/docs/1.0.27-alpha/api/valueof/index.html b/docs/1.0.27-alpha/api/valueof/index.html index a26e4efd6e..03d65da3d1 100644 --- a/docs/1.0.27-alpha/api/valueof/index.html +++ b/docs/1.0.27-alpha/api/valueof/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.27-alpha

valueOf

operator​

tuple​

  • ["===", T]
  • const tupleValueOf = type(["valueOf", {a:"string"}])

helper​

  • valueOf(T)
  • const helperValueOf = valueOf({a:"string"})
- + \ No newline at end of file diff --git a/docs/1.0.27-alpha/index.html b/docs/1.0.27-alpha/index.html index 228df528f3..1f528e1474 100644 --- a/docs/1.0.27-alpha/index.html +++ b/docs/1.0.27-alpha/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.27-alpha

Getting Started

Install 📦12KB gzipped, 0 dependencies​

Npm Icon npm install arktype(or whatever package manager you prefer)

Our types are tested in strict-mode with TypeScript versions 4.8, 4.9, and 5.0.

Our APIs have mostly stabilized, but details may still change during the alpha/beta stages of our 1.0 release. If you have suggestions that may require a breaking change, now is the time to let us know! ⛵

Your first type​

- + \ No newline at end of file diff --git a/docs/1.0.27-alpha/scopes/index.html b/docs/1.0.27-alpha/scopes/index.html index 1398d5fcc3..e5e36efd6b 100644 --- a/docs/1.0.27-alpha/scopes/index.html +++ b/docs/1.0.27-alpha/scopes/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.27-alpha

Scopes

- + \ No newline at end of file diff --git a/docs/api/ark/index.html b/docs/api/ark/index.html index 6093e4d67c..13312d7c83 100644 --- a/docs/api/ark/index.html +++ b/docs/api/ark/index.html @@ -7,13 +7,13 @@ - + - + \ No newline at end of file diff --git a/docs/api/arkscope/index.html b/docs/api/arkscope/index.html index 9e8751fd51..a4a29d4a63 100644 --- a/docs/api/arkscope/index.html +++ b/docs/api/arkscope/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.28-alpha

arkScope

text​

arkScope: import("./scope.js").Scope<
[
{
any: any
bigint: bigint
boolean: boolean
false: false
never: never
null: null
number: number
object: object
string: string
symbol: symbol
true: true
unknown: unknown
void: void
undefined: undefined
Function: (...args: any[]) => unknown
Date: Date
Error: Error
Map: Map<unknown, unknown>
RegExp: RegExp
Set: Set<unknown>
WeakMap: WeakMap<object, unknown>
WeakSet: WeakSet<object>
Promise: Promise<unknown>
alpha: string
alphanumeric: string
lowercase: string
uppercase: string
creditCard: string
email: string
uuid: string
parsedNumber: (In: string) => Out<number>
parsedInteger: (In: string) => Out<number>
parsedDate: (In: string) => Out<Date>
semver: string
json: (In: string) => Out<unknown>
integer: number
},
{},
false
]
>
- + \ No newline at end of file diff --git a/docs/api/arrayof/index.html b/docs/api/arrayof/index.html index dce59f3e46..61be136963 100644 --- a/docs/api/arrayof/index.html +++ b/docs/api/arrayof/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.28-alpha

arrayOf

operator​

string​

  • "T[]"
  • const numberArray = type("number[]")

tuple​

  • [T, "[]"]
  • const tupleArray = type(["number", "[]"])

helper​

  • arrayOf(T)
  • const helperArray = arrayOf("number")
- + \ No newline at end of file diff --git a/docs/api/index.html b/docs/api/index.html index ccd3f73c5b..a359ded100 100644 --- a/docs/api/index.html +++ b/docs/api/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.28-alpha

API

ArkType supports many of TypeScript's built-in types and operators, as well as some new ones dedicated exclusively to runtime validation. In fact, we got a little ahead of ourselves and built a ton of cool features, but we're still working on getting caught up syntax and API docs. Keep an eye out for more in the next couple weeks ⛵

In the meantime, check out the examples here and use the type hints you get to learn how you can customize your types and scopes. If you want to explore some of the more advanced features, take a look at our unit tests or ask us on Discord if your functionality is supported. If not, create a GitHub issue so we can prioritize it!

- + \ No newline at end of file diff --git a/docs/api/infer/index.html b/docs/api/infer/index.html index 36ca03ecd3..fa59fc218b 100644 --- a/docs/api/infer/index.html +++ b/docs/api/infer/index.html @@ -7,13 +7,13 @@ - + - + \ No newline at end of file diff --git a/docs/api/inferdefinition/index.html b/docs/api/inferdefinition/index.html index 15d76c6caf..3ff0d4edd4 100644 --- a/docs/api/inferdefinition/index.html +++ b/docs/api/inferdefinition/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.28-alpha

inferDefinition

text​

export type inferDefinition<def, $> = isAny<def> extends true
? never
: def extends Infer<infer t> | InferredThunk<infer t>
? t
: def extends string
? inferString<def, $>
: def extends List
? inferTuple<def, $>
: def extends RegExp
? string
: def extends Dict
? inferRecord<def, $>
: never
- + \ No newline at end of file diff --git a/docs/api/instanceof/index.html b/docs/api/instanceof/index.html index 4db3a298ab..9b2a9258bc 100644 --- a/docs/api/instanceof/index.html +++ b/docs/api/instanceof/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.28-alpha

instanceOf

operator​

tuple​

  • ["instanceOf", T]
  • const tupleInstanceOf = type(["instanceOf", Date])

helper​

  • instanceOf(T)
  • const helperInstanceOf = instanceOf(Date)
- + \ No newline at end of file diff --git a/docs/api/intersection/index.html b/docs/api/intersection/index.html index a768edbc64..e6dbbcceff 100644 --- a/docs/api/intersection/index.html +++ b/docs/api/intersection/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.28-alpha

intersection

operator​

string​

  • "L&R"
  • const intersection = type("/@arktype.io$/ & email")

tuple​

  • [L, "&", R]
  • const tupleIntersection = type(["/@arktype.io$/", "&", "email"])

helper​

  • intersection(L,R)
  • const helperIntersection = intersection("/@arktype.io$/","email")
- + \ No newline at end of file diff --git a/docs/api/jsobjectsscope/index.html b/docs/api/jsobjectsscope/index.html index d19b7c1369..e0bb7a8f37 100644 --- a/docs/api/jsobjectsscope/index.html +++ b/docs/api/jsobjectsscope/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.28-alpha

jsObjectsScope

text​

NameTypeDescription
Function (...args: any[]) => unknown
Date Date
Error Error
Map Map<unknown, unknown>
RegExp RegExp
Set Set<unknown>
WeakMap WeakMap<object, unknown>
WeakSet WeakSet<object>
Promise Promise<unknown>
- + \ No newline at end of file diff --git a/docs/api/keyof/index.html b/docs/api/keyof/index.html index 1d3c004637..bed2cd5055 100644 --- a/docs/api/keyof/index.html +++ b/docs/api/keyof/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.28-alpha

keyOf

operator​

tuple​

  • "["keyOf", T]"
  • const tupleKeyOf = type(["keyOf", {a:"string"}])

helper​

  • keyOf(T)
  • const helperKeyOf = keyOf({a:"string"})
- + \ No newline at end of file diff --git a/docs/api/keywords/index.html b/docs/api/keywords/index.html index c91d8192f2..c503a31b76 100644 --- a/docs/api/keywords/index.html +++ b/docs/api/keywords/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.28-alpha

Keywords

jsObjectsScope​

NameTypeDescription
Function (...args: any[]) => unknown
Date Date
Error Error
Map Map<unknown, unknown>
RegExp RegExp
Set Set<unknown>
WeakMap WeakMap<object, unknown>
WeakSet WeakSet<object>
Promise Promise<unknown>

tsKeywordsScope​

NameTypeDescription
any anyany
bigint biginta bigint
boolean booleana boolean
false falsefalse
never nevernever
null nullnull
number numbera number
object objectan object
string stringa string
symbol symbola symbol
true truetrue
unknown unknownunknown
void voidvoid
undefined undefinedundefined

validationScope​

NameTypeDescription
alpha stringonly letters
alphanumeric stringonly letters and digits
lowercase stringonly lowercase letters
uppercase stringonly uppercase letters
creditCard stringa valid credit card number
email stringa valid email
uuid stringa valid UUID
parsedNumber (In: string) => import("../../parse/ast/morph.js").Out<number>a well-formed numeric string
parsedInteger (In: string) => import("../../parse/ast/morph.js").Out<number>a well-formed integer string
parsedDate (In: string) => import("../../parse/ast/morph.js").Out<Date>a valid date
semver stringa valid semantic version
json (In: string) => import("../../parse/ast/morph.js").Out<unknown>a JSON-parsable string
integer numberan integer
- + \ No newline at end of file diff --git a/docs/api/morph/index.html b/docs/api/morph/index.html index 4ed5ddbfbb..946477d5e8 100644 --- a/docs/api/morph/index.html +++ b/docs/api/morph/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.28-alpha

morph

operator​

tuple​

  • [inputType, "|>", (data) => output]
  • const tupleMorph = type( ["string", "|>" , (data) => `morphed ${data}`])

helper​

  • morph(inputType, (data) => output)
  • const helperMorph = morph("string", (data) => `morphed ${data}`)
- + \ No newline at end of file diff --git a/docs/api/narrow/index.html b/docs/api/narrow/index.html index c1ca30bbde..c8b02672fc 100644 --- a/docs/api/narrow/index.html +++ b/docs/api/narrow/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.28-alpha

narrow

operator​

tuple​

  • ["type", "=>" , condition]
  • const narrow = type( ["number", "=>" , (n) => n % 2 === 0])

example​

  •      const isEven = (x: unknown): x is number => x % 2 === 0
- + \ No newline at end of file diff --git a/docs/api/operators/index.html b/docs/api/operators/index.html index 08cf4b5380..250669dbb8 100644 --- a/docs/api/operators/index.html +++ b/docs/api/operators/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.28-alpha

Operators

Operating Table​

operatorstringtuplehelper
arrayOf"T[]"[T, "[]"]arrayOf(T)
instanceOf["instanceOf", T]instanceOf(T)
&"L&R"[L, "&", R]intersection(L,R)
keyOf"["keyOf", T]"keyOf(T)
|>[inputType, "|>", (data) => output]morph(inputType, (data) => output)
=>["type", "=>" , condition]
|"L|R"[L, "|" , R]union(L,R)
===["===", T]valueOf(T)
:["type", ":", config]
bound"N<S<N", with comparators restricted to < or <=
%"N%D", where "N" is a number and "D" is a non-zero integer
node["node", nodeDefinition]type.from(nodeDefinition)
- + \ No newline at end of file diff --git a/docs/api/parseconfigtuple/index.html b/docs/api/parseconfigtuple/index.html index e2b67ce971..75aea05768 100644 --- a/docs/api/parseconfigtuple/index.html +++ b/docs/api/parseconfigtuple/index.html @@ -7,13 +7,13 @@ - + - + \ No newline at end of file diff --git a/docs/api/precompileddefaults/index.html b/docs/api/precompileddefaults/index.html index 565a143d68..e0fc926f56 100644 --- a/docs/api/precompileddefaults/index.html +++ b/docs/api/precompileddefaults/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.28-alpha

PrecompiledDefaults

text​

export type PrecompiledDefaults = {
any: any
bigint: bigint
boolean: boolean
false: false
never: never
null: null
number: number
object: object
string: string
symbol: symbol
true: true
unknown: unknown
void: void
undefined: undefined
integer: number
alpha: string
alphanumeric: string
lowercase: string
uppercase: string
creditCard: string
email: string
uuid: string
semver: string
json: (In: string) => Out<unknown>
parsedNumber: (In: string) => Out<number>
parsedInteger: (In: string) => Out<number>
parsedDate: (In: string) => Out<Date>
Function: (...args: any[]) => unknown
Date: Date
Error: Error
Map: Map<unknown, unknown>
RegExp: RegExp
Set: Set<unknown>
WeakMap: WeakMap<object, unknown>
WeakSet: WeakSet<object>
Promise: Promise<unknown>
}
- + \ No newline at end of file diff --git a/docs/api/problem/index.html b/docs/api/problem/index.html index 960d892502..60d18ce5c7 100644 --- a/docs/api/problem/index.html +++ b/docs/api/problem/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.28-alpha

Problem

text​

export declare class Problem<code extends ProblemCode = ProblemCode> {
code: code
path: Path
private data
private source
private writers
parts?: Problem[]
constructor(
code: code,
path: Path,
data: ProblemData<code>,
source: ProblemSource<code>,
writers: ProblemWriters<code>
)
toString(): string
get message(): string
get reason(): string
get mustBe(): string
}
- + \ No newline at end of file diff --git a/docs/api/problems/index.html b/docs/api/problems/index.html index 9b9a65f06b..c916190569 100644 --- a/docs/api/problems/index.html +++ b/docs/api/problems/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.28-alpha

Problems

text​

Problems: new (state: TraversalState) => Problems
export type Problems = arraySubclassToReadonly<ProblemArray>;
- + \ No newline at end of file diff --git a/docs/api/resolvednode/index.html b/docs/api/resolvednode/index.html index ecc8384752..adeb58ec9b 100644 --- a/docs/api/resolvednode/index.html +++ b/docs/api/resolvednode/index.html @@ -7,13 +7,13 @@ - + - + \ No newline at end of file diff --git a/docs/api/scope/index.html b/docs/api/scope/index.html index ec085acc5d..bc489ed4ef 100644 --- a/docs/api/scope/index.html +++ b/docs/api/scope/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.28-alpha

scope

text​

scope: ScopeParser

hide_table_of_contents: true​

Scope

text​

export declare class Scope<context extends ScopeContext = any> {
#private
aliases: Dict
name: string
config: ScopeConfig
parseCache: FreezingCache<Node>
constructor(aliases: Dict, opts?: ScopeOptions)
getAnonymousQualifiedName(base: AnonymousTypeName): QualifiedTypeName
addAnonymousTypeReference(referencedType: Type, ctx: ParseContext): Node
get infer(): exportsOf<context>
compile(): Space<exportsOf<context>>
addParsedReferenceIfResolvable(
name: name<context>,
ctx: ParseContext
): boolean
resolve(name: name<context>): Type
resolveNode(node: Node): ResolvedNode
resolveTypeNode(node: Node): TypeNode
expressions: Expressions<resolutions<context>>
intersection: import("./expressions.js").BinaryExpressionParser<
resolutions<context>,
"&"
>
union: import("./expressions.js").BinaryExpressionParser<
resolutions<context>,
"|"
>
arrayOf: import("./expressions.js").UnaryExpressionParser<
resolutions<context>,
"[]"
>
keyOf: import("./expressions.js").UnaryExpressionParser<
resolutions<context>,
"keyof"
>
valueOf: import("./expressions.js").UnvalidatedExpressionParser<
resolutions<context>,
"==="
>
instanceOf: import("./expressions.js").UnvalidatedExpressionParser<
resolutions<context>,
"instanceof"
>
narrow: import("./expressions.js").FunctionalExpressionParser<
resolutions<context>,
"=>"
>
morph: import("./expressions.js").FunctionalExpressionParser<
resolutions<context>,
"|>"
>
type: TypeParser<resolutions<context>>
isResolvable(name: string): unknown
}
- + \ No newline at end of file diff --git a/docs/api/space/index.html b/docs/api/space/index.html index 403c960daf..4bd7afb296 100644 --- a/docs/api/space/index.html +++ b/docs/api/space/index.html @@ -7,13 +7,13 @@ - + - + \ No newline at end of file diff --git a/docs/api/tskeywordsscope/index.html b/docs/api/tskeywordsscope/index.html index 03fa3857ca..a5a097c1e6 100644 --- a/docs/api/tskeywordsscope/index.html +++ b/docs/api/tskeywordsscope/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.28-alpha

tsKeywordsScope

keywords​

  • keywords: {"any": "any", "bigint": "a bigint", "boolean": "a boolean", "false": "false", "never": "never", "null": "null", "number": "a number", "object": "an object", "string": "a string", "symbol": "a symbol", "true": "true", "unknown": "unknown", "void": "void", "undefined": "undefined"}

text​

NameTypeDescription
any anyany
bigint biginta bigint
boolean booleana boolean
false falsefalse
never nevernever
null nullnull
number numbera number
object objectan object
string stringa string
symbol symbola symbol
true truetrue
unknown unknownunknown
void voidvoid
undefined undefinedundefined
- + \ No newline at end of file diff --git a/docs/api/type/index.html b/docs/api/type/index.html index e6a3a88e42..22fa3cd9cb 100644 --- a/docs/api/type/index.html +++ b/docs/api/type/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.28-alpha

type

text​

type: TypeParser<PrecompiledDefaults>

hide_table_of_contents: true​

Type

text​

export type Type<t = unknown> = defer<Checker<t> & TypeRoot<t>>
- + \ No newline at end of file diff --git a/docs/api/union/index.html b/docs/api/union/index.html index 8a5f503b56..b7e38da27b 100644 --- a/docs/api/union/index.html +++ b/docs/api/union/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.28-alpha

union

operator​

string​

  • "L|R"
  • const union = type("string|number")

tuple​

  • [L, "|" , R]
  • const tupleUnion = type(["string", "|", "number"])

helper​

  • union(L,R)
  • const helperUnion = union("string", "number")
- + \ No newline at end of file diff --git a/docs/api/validatebound/index.html b/docs/api/validatebound/index.html index a1ab2c925a..b632f38988 100644 --- a/docs/api/validatebound/index.html +++ b/docs/api/validatebound/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.28-alpha

validateBound

operator​

tableRow​

VariableDescription
Nnumber literal
Ssized data (a number, string or array)
<Comparator (one of <, <=, ==, >=, >)

description​

  • Bound operators allow data to be bounded in the format "S<N", or as a Range: "N<S<N", with comparators restricted to < or <=

string​

  • "N<S<N", with comparators restricted to < or <=
  • const range = type("2<=number<5")
  • const bound = type("string[]==5")
- + \ No newline at end of file diff --git a/docs/api/validatedefinition/index.html b/docs/api/validatedefinition/index.html index 6a562ec171..74cdd6047c 100644 --- a/docs/api/validatedefinition/index.html +++ b/docs/api/validatedefinition/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.28-alpha

validateDefinition

text​

export type validateDefinition<def, $> = [def] extends [(...args: any[]) => any]
? def
: def extends Terminal
? def
: def extends string
? validateString<def, $>
: def extends TupleExpression
? validateTupleExpression<def, $>
: def extends BadDefinitionType
? writeBadDefinitionTypeMessage<
objectKindOf<def> extends string ? objectKindOf<def> : domainOf<def>
>
: isUnknown<def> extends true
? stringKeyOf<$>
: evaluate<{
[k in keyof def]: validateDefinition<def[k], $>
}>
- + \ No newline at end of file diff --git a/docs/api/validatedivisor/index.html b/docs/api/validatedivisor/index.html index 1eaa2e2132..a98560e6ab 100644 --- a/docs/api/validatedivisor/index.html +++ b/docs/api/validatedivisor/index.html @@ -7,13 +7,13 @@ - + - + \ No newline at end of file diff --git a/docs/api/validationscope/index.html b/docs/api/validationscope/index.html index d511ea6f40..d428c67e16 100644 --- a/docs/api/validationscope/index.html +++ b/docs/api/validationscope/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.28-alpha

validationScope

keywords​

  • keywords: { "alpha": "only letters", "alphanumeric": "only letters and digits", "lowercase": "only lowercase letters", "uppercase": "only uppercase letters", "creditCard": "a valid credit card number", "email": "a valid email", "uuid": "a valid UUID", "parsedNumber": "a well-formed numeric string", "parsedInteger": "a well-formed integer string", "parsedDate": "a valid date", "semver": "a valid semantic version", "json": "a JSON-parsable string", "integer": "an integer"}

text​

NameTypeDescription
alpha stringonly letters
alphanumeric stringonly letters and digits
lowercase stringonly lowercase letters
uppercase stringonly uppercase letters
creditCard stringa valid credit card number
email stringa valid email
uuid stringa valid UUID
parsedNumber (In: string) => import("../../parse/ast/morph.js").Out<number>a well-formed numeric string
parsedInteger (In: string) => import("../../parse/ast/morph.js").Out<number>a well-formed integer string
parsedDate (In: string) => import("../../parse/ast/morph.js").Out<Date>a valid date
semver stringa valid semantic version
json (In: string) => import("../../parse/ast/morph.js").Out<unknown>a JSON-parsable string
integer numberan integer
- + \ No newline at end of file diff --git a/docs/api/valueof/index.html b/docs/api/valueof/index.html index 70fd803386..1b6a18036c 100644 --- a/docs/api/valueof/index.html +++ b/docs/api/valueof/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.28-alpha

valueOf

operator​

tuple​

  • ["===", T]
  • const tupleValueOf = type(["valueOf", {a:"string"}])

helper​

  • valueOf(T)
  • const helperValueOf = valueOf({a:"string"})
- + \ No newline at end of file diff --git a/docs/index.html b/docs/index.html index bb487ceedf..2110c4f1cd 100644 --- a/docs/index.html +++ b/docs/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.28-alpha

Getting Started

Install 📦12KB gzipped, 0 dependencies​

Npm Icon npm install arktype(or whatever package manager you prefer)

Our types are tested in strict-mode with TypeScript versions 4.8, 4.9, and 5.0.

Our APIs have mostly stabilized, but details may still change during the alpha/beta stages of our 1.0 release. If you have suggestions that may require a breaking change, now is the time to let us know! ⛵

Your first type​

- + \ No newline at end of file diff --git a/docs/next/api/ark/index.html b/docs/next/api/ark/index.html index 2d18201acf..1053d6025d 100644 --- a/docs/next/api/ark/index.html +++ b/docs/next/api/ark/index.html @@ -7,13 +7,13 @@ - +
Version: Next

ark

text​

ark: Space<PrecompiledDefaults>
- + \ No newline at end of file diff --git a/docs/next/api/arkscope/index.html b/docs/next/api/arkscope/index.html index b40bbe1e22..df50456a6e 100644 --- a/docs/next/api/arkscope/index.html +++ b/docs/next/api/arkscope/index.html @@ -7,13 +7,13 @@ - +
Version: Next

arkScope

text​

arkScope: import("./scope.js").Scope<
[
{
any: any
bigint: bigint
boolean: boolean
false: false
never: never
null: null
number: number
object: object
string: string
symbol: symbol
true: true
unknown: unknown
void: void
undefined: undefined
Function: (...args: any[]) => unknown
Date: Date
Error: Error
Map: Map<unknown, unknown>
RegExp: RegExp
Set: Set<unknown>
WeakMap: WeakMap<object, unknown>
WeakSet: WeakSet<object>
Promise: Promise<unknown>
alpha: string
alphanumeric: string
lowercase: string
uppercase: string
creditCard: string
email: string
uuid: string
parsedNumber: (In: string) => Out<number>
parsedInteger: (In: string) => Out<number>
parsedDate: (In: string) => Out<Date>
semver: string
json: (In: string) => Out<unknown>
integer: number
},
{},
false
]
>
- + \ No newline at end of file diff --git a/docs/next/api/arrayof/index.html b/docs/next/api/arrayof/index.html index 134ad6882e..f44eecd4af 100644 --- a/docs/next/api/arrayof/index.html +++ b/docs/next/api/arrayof/index.html @@ -7,13 +7,13 @@ - +
Version: Next

arrayOf

operator​

string​

  • "T[]"
  • const numberArray = type("number[]")

tuple​

  • [T, "[]"]
  • const tupleArray = type(["number", "[]"])

helper​

  • arrayOf(T)
  • const helperArray = arrayOf("number")
- + \ No newline at end of file diff --git a/docs/next/api/index.html b/docs/next/api/index.html index add9c1d4e3..a4a93f9648 100644 --- a/docs/next/api/index.html +++ b/docs/next/api/index.html @@ -7,13 +7,13 @@ - +
Version: Next

API

ArkType supports many of TypeScript's built-in types and operators, as well as some new ones dedicated exclusively to runtime validation. In fact, we got a little ahead of ourselves and built a ton of cool features, but we're still working on getting caught up syntax and API docs. Keep an eye out for more in the next couple weeks ⛵

In the meantime, check out the examples here and use the type hints you get to learn how you can customize your types and scopes. If you want to explore some of the more advanced features, take a look at our unit tests or ask us on Discord if your functionality is supported. If not, create a GitHub issue so we can prioritize it!

- + \ No newline at end of file diff --git a/docs/next/api/infer/index.html b/docs/next/api/infer/index.html index 60906be9e7..5edfa8178d 100644 --- a/docs/next/api/infer/index.html +++ b/docs/next/api/infer/index.html @@ -7,13 +7,13 @@ - +
Version: Next

Infer

text​

export type Infer<t> = {
[as]?: t
}
- + \ No newline at end of file diff --git a/docs/next/api/inferdefinition/index.html b/docs/next/api/inferdefinition/index.html index bd59e82b83..f4f70013be 100644 --- a/docs/next/api/inferdefinition/index.html +++ b/docs/next/api/inferdefinition/index.html @@ -7,13 +7,13 @@ - +
Version: Next

inferDefinition

text​

export type inferDefinition<def, $> = isAny<def> extends true
? never
: def extends Infer<infer t> | InferredThunk<infer t>
? t
: def extends string
? inferString<def, $>
: def extends List
? inferTuple<def, $>
: def extends RegExp
? string
: def extends Dict
? inferRecord<def, $>
: never
- + \ No newline at end of file diff --git a/docs/next/api/instanceof/index.html b/docs/next/api/instanceof/index.html index 2ca29b11b3..46f250e09f 100644 --- a/docs/next/api/instanceof/index.html +++ b/docs/next/api/instanceof/index.html @@ -7,13 +7,13 @@ - +
Version: Next

instanceOf

operator​

tuple​

  • ["instanceOf", T]
  • const tupleInstanceOf = type(["instanceOf", Date])

helper​

  • instanceOf(T)
  • const helperInstanceOf = instanceOf(Date)
- + \ No newline at end of file diff --git a/docs/next/api/intersection/index.html b/docs/next/api/intersection/index.html index 1cbee2a733..3d06a9e011 100644 --- a/docs/next/api/intersection/index.html +++ b/docs/next/api/intersection/index.html @@ -7,13 +7,13 @@ - +
Version: Next

intersection

operator​

string​

  • "L&R"
  • const intersection = type("/@arktype.io$/ & email")

tuple​

  • [L, "&", R]
  • const tupleIntersection = type(["/@arktype.io$/", "&", "email"])

helper​

  • intersection(L,R)
  • const helperIntersection = intersection("/@arktype.io$/","email")
- + \ No newline at end of file diff --git a/docs/next/api/jsobjectsscope/index.html b/docs/next/api/jsobjectsscope/index.html index 7e55c3645f..ccbed93fff 100644 --- a/docs/next/api/jsobjectsscope/index.html +++ b/docs/next/api/jsobjectsscope/index.html @@ -7,13 +7,13 @@ - +
Version: Next

jsObjectsScope

text​

NameTypeDescription
Function (...args: any[]) => unknown
Date Date
Error Error
Map Map<unknown, unknown>
RegExp RegExp
Set Set<unknown>
WeakMap WeakMap<object, unknown>
WeakSet WeakSet<object>
Promise Promise<unknown>
- + \ No newline at end of file diff --git a/docs/next/api/keyof/index.html b/docs/next/api/keyof/index.html index 3ae3258923..db294c3e85 100644 --- a/docs/next/api/keyof/index.html +++ b/docs/next/api/keyof/index.html @@ -7,13 +7,13 @@ - +
Version: Next

keyOf

operator​

tuple​

  • "["keyOf", T]"
  • const tupleKeyOf = type(["keyOf", {a:"string"}])

helper​

  • keyOf(T)
  • const helperKeyOf = keyOf({a:"string"})
- + \ No newline at end of file diff --git a/docs/next/api/keywords/index.html b/docs/next/api/keywords/index.html index 9bcbcfc38e..688823fd02 100644 --- a/docs/next/api/keywords/index.html +++ b/docs/next/api/keywords/index.html @@ -7,13 +7,13 @@ - +
Version: Next

Keywords

jsObjectsScope​

NameTypeDescription
Function (...args: any[]) => unknown
Date Date
Error Error
Map Map<unknown, unknown>
RegExp RegExp
Set Set<unknown>
WeakMap WeakMap<object, unknown>
WeakSet WeakSet<object>
Promise Promise<unknown>

tsKeywordsScope​

NameTypeDescription
any anyany
bigint biginta bigint
boolean booleana boolean
false falsefalse
never nevernever
null nullnull
number numbera number
object objectan object
string stringa string
symbol symbola symbol
true truetrue
unknown unknownunknown
void voidvoid
undefined undefinedundefined

validationScope​

NameTypeDescription
alpha stringonly letters
alphanumeric stringonly letters and digits
lowercase stringonly lowercase letters
uppercase stringonly uppercase letters
creditCard stringa valid credit card number
email stringa valid email
uuid stringa valid UUID
parsedNumber (In: string) => import("../../parse/ast/morph.js").Out<number>a well-formed numeric string
parsedInteger (In: string) => import("../../parse/ast/morph.js").Out<number>a well-formed integer string
parsedDate (In: string) => import("../../parse/ast/morph.js").Out<Date>a valid date
semver stringa valid semantic version
json (In: string) => import("../../parse/ast/morph.js").Out<unknown>a JSON-parsable string
integer numberan integer
- + \ No newline at end of file diff --git a/docs/next/api/morph/index.html b/docs/next/api/morph/index.html index 7b76b275cc..e965ffb8b7 100644 --- a/docs/next/api/morph/index.html +++ b/docs/next/api/morph/index.html @@ -7,13 +7,13 @@ - +
Version: Next

morph

operator​

tuple​

  • [inputType, "|>", (data) => output]
  • const tupleMorph = type( ["string", "|>" , (data) => `morphed ${data}`])

helper​

  • morph(inputType, (data) => output)
  • const helperMorph = morph("string", (data) => `morphed ${data}`)
- + \ No newline at end of file diff --git a/docs/next/api/narrow/index.html b/docs/next/api/narrow/index.html index 9f4754a605..a1618484d6 100644 --- a/docs/next/api/narrow/index.html +++ b/docs/next/api/narrow/index.html @@ -7,13 +7,13 @@ - +
Version: Next

narrow

operator​

tuple​

  • ["type", "=>" , condition]
  • const narrow = type( ["number", "=>" , (n) => n % 2 === 0])

example​

  •      const isEven = (x: unknown): x is number => x % 2 === 0
- + \ No newline at end of file diff --git a/docs/next/api/operators/index.html b/docs/next/api/operators/index.html index 023de9ad13..da5fc8eb95 100644 --- a/docs/next/api/operators/index.html +++ b/docs/next/api/operators/index.html @@ -7,13 +7,13 @@ - +
Version: Next

Operators

Operating Table​

operatorstringtuplehelper
arrayOf"T[]"[T, "[]"]arrayOf(T)
instanceOf["instanceOf", T]instanceOf(T)
&"L&R"[L, "&", R]intersection(L,R)
keyOf"["keyOf", T]"keyOf(T)
|>[inputType, "|>", (data) => output]morph(inputType, (data) => output)
=>["type", "=>" , condition]
|"L|R"[L, "|" , R]union(L,R)
===["===", T]valueOf(T)
:["type", ":", config]
bound"N<S<N", with comparators restricted to < or <=
%"N%D", where "N" is a number and "D" is a non-zero integer
node["node", nodeDefinition]type.from(nodeDefinition)
- + \ No newline at end of file diff --git a/docs/next/api/parseconfigtuple/index.html b/docs/next/api/parseconfigtuple/index.html index 391c0eff3e..852a6a0b90 100644 --- a/docs/next/api/parseconfigtuple/index.html +++ b/docs/next/api/parseconfigtuple/index.html @@ -7,13 +7,13 @@ - +
- + \ No newline at end of file diff --git a/docs/next/api/precompileddefaults/index.html b/docs/next/api/precompileddefaults/index.html index 7b8b63c127..b560e9620b 100644 --- a/docs/next/api/precompileddefaults/index.html +++ b/docs/next/api/precompileddefaults/index.html @@ -7,13 +7,13 @@ - +
Version: Next

PrecompiledDefaults

text​

export type PrecompiledDefaults = {
any: any
bigint: bigint
boolean: boolean
false: false
never: never
null: null
number: number
object: object
string: string
symbol: symbol
true: true
unknown: unknown
void: void
undefined: undefined
integer: number
alpha: string
alphanumeric: string
lowercase: string
uppercase: string
creditCard: string
email: string
uuid: string
semver: string
json: (In: string) => Out<unknown>
parsedNumber: (In: string) => Out<number>
parsedInteger: (In: string) => Out<number>
parsedDate: (In: string) => Out<Date>
Function: (...args: any[]) => unknown
Date: Date
Error: Error
Map: Map<unknown, unknown>
RegExp: RegExp
Set: Set<unknown>
WeakMap: WeakMap<object, unknown>
WeakSet: WeakSet<object>
Promise: Promise<unknown>
}
- + \ No newline at end of file diff --git a/docs/next/api/problem/index.html b/docs/next/api/problem/index.html index d21ef0870a..a516866523 100644 --- a/docs/next/api/problem/index.html +++ b/docs/next/api/problem/index.html @@ -7,13 +7,13 @@ - +
Version: Next

Problem

text​

export declare class Problem<code extends ProblemCode = ProblemCode> {
code: code
path: Path
private data
private source
private writers
parts?: Problem[]
constructor(
code: code,
path: Path,
data: ProblemData<code>,
source: ProblemSource<code>,
writers: ProblemWriters<code>
)
toString(): string
get message(): string
get reason(): string
get mustBe(): string
}
- + \ No newline at end of file diff --git a/docs/next/api/problems/index.html b/docs/next/api/problems/index.html index 982e18b591..4f4d1316e8 100644 --- a/docs/next/api/problems/index.html +++ b/docs/next/api/problems/index.html @@ -7,13 +7,13 @@ - +
Version: Next

Problems

text​

Problems: new (state: TraversalState) => Problems
export type Problems = arraySubclassToReadonly<ProblemArray>;
- + \ No newline at end of file diff --git a/docs/next/api/resolvednode/index.html b/docs/next/api/resolvednode/index.html index 696b08944a..119c344516 100644 --- a/docs/next/api/resolvednode/index.html +++ b/docs/next/api/resolvednode/index.html @@ -7,13 +7,13 @@ - +
- + \ No newline at end of file diff --git a/docs/next/api/scope/index.html b/docs/next/api/scope/index.html index a7499de3d2..a212b691c9 100644 --- a/docs/next/api/scope/index.html +++ b/docs/next/api/scope/index.html @@ -7,13 +7,13 @@ - +
Version: Next

scope

text​

scope: ScopeParser

hide_table_of_contents: true​

Scope

text​

export declare class Scope<context extends ScopeContext = any> {
#private
aliases: Dict
name: string
config: ScopeConfig
parseCache: FreezingCache<Node>
constructor(aliases: Dict, opts?: ScopeOptions)
getAnonymousQualifiedName(base: AnonymousTypeName): QualifiedTypeName
addAnonymousTypeReference(referencedType: Type, ctx: ParseContext): Node
get infer(): exportsOf<context>
compile(): Space<exportsOf<context>>
addParsedReferenceIfResolvable(
name: name<context>,
ctx: ParseContext
): boolean
resolve(name: name<context>): Type
resolveNode(node: Node): ResolvedNode
resolveTypeNode(node: Node): TypeNode
expressions: Expressions<resolutions<context>>
intersection: import("./expressions.js").BinaryExpressionParser<
resolutions<context>,
"&"
>
union: import("./expressions.js").BinaryExpressionParser<
resolutions<context>,
"|"
>
arrayOf: import("./expressions.js").UnaryExpressionParser<
resolutions<context>,
"[]"
>
keyOf: import("./expressions.js").UnaryExpressionParser<
resolutions<context>,
"keyof"
>
valueOf: import("./expressions.js").UnvalidatedExpressionParser<
resolutions<context>,
"==="
>
instanceOf: import("./expressions.js").UnvalidatedExpressionParser<
resolutions<context>,
"instanceof"
>
narrow: import("./expressions.js").FunctionalExpressionParser<
resolutions<context>,
"=>"
>
morph: import("./expressions.js").FunctionalExpressionParser<
resolutions<context>,
"|>"
>
type: TypeParser<resolutions<context>>
isResolvable(name: string): unknown
}
- + \ No newline at end of file diff --git a/docs/next/api/space/index.html b/docs/next/api/space/index.html index 9008be02af..f5148bfdc8 100644 --- a/docs/next/api/space/index.html +++ b/docs/next/api/space/index.html @@ -7,13 +7,13 @@ - +
Version: Next

Space

text​

export type Space<exports = Dict> = {
[k in keyof exports]: Type<exports[k]>
}
- + \ No newline at end of file diff --git a/docs/next/api/tskeywordsscope/index.html b/docs/next/api/tskeywordsscope/index.html index 4d62f1c607..03728c1967 100644 --- a/docs/next/api/tskeywordsscope/index.html +++ b/docs/next/api/tskeywordsscope/index.html @@ -7,13 +7,13 @@ - +
Version: Next

tsKeywordsScope

keywords​

  • keywords: {"any": "any", "bigint": "a bigint", "boolean": "a boolean", "false": "false", "never": "never", "null": "null", "number": "a number", "object": "an object", "string": "a string", "symbol": "a symbol", "true": "true", "unknown": "unknown", "void": "void", "undefined": "undefined"}

text​

NameTypeDescription
any anyany
bigint biginta bigint
boolean booleana boolean
false falsefalse
never nevernever
null nullnull
number numbera number
object objectan object
string stringa string
symbol symbola symbol
true truetrue
unknown unknownunknown
void voidvoid
undefined undefinedundefined
- + \ No newline at end of file diff --git a/docs/next/api/type/index.html b/docs/next/api/type/index.html index 770afcb748..5737b8c7bb 100644 --- a/docs/next/api/type/index.html +++ b/docs/next/api/type/index.html @@ -7,13 +7,13 @@ - +
Version: Next

type

text​

type: TypeParser<PrecompiledDefaults>

hide_table_of_contents: true​

Type

text​

export type Type<t = unknown> = defer<Checker<t> & TypeRoot<t>>
- + \ No newline at end of file diff --git a/docs/next/api/union/index.html b/docs/next/api/union/index.html index 9348ea8998..5f9f3f4db0 100644 --- a/docs/next/api/union/index.html +++ b/docs/next/api/union/index.html @@ -7,13 +7,13 @@ - +
Version: Next

union

operator​

string​

  • "L|R"
  • const union = type("string|number")

tuple​

  • [L, "|" , R]
  • const tupleUnion = type(["string", "|", "number"])

helper​

  • union(L,R)
  • const helperUnion = union("string", "number")
- + \ No newline at end of file diff --git a/docs/next/api/validatebound/index.html b/docs/next/api/validatebound/index.html index 8105f4fcb5..526b702dce 100644 --- a/docs/next/api/validatebound/index.html +++ b/docs/next/api/validatebound/index.html @@ -7,13 +7,13 @@ - +
Version: Next

validateBound

operator​

tableRow​

VariableDescription
Nnumber literal
Ssized data (a number, string or array)
<Comparator (one of <, <=, ==, >=, >)

description​

  • Bound operators allow data to be bounded in the format "S<N", or as a Range: "N<S<N", with comparators restricted to < or <=

string​

  • "N<S<N", with comparators restricted to < or <=
  • const range = type("2<=number<5")
  • const bound = type("string[]==5")
- + \ No newline at end of file diff --git a/docs/next/api/validatedefinition/index.html b/docs/next/api/validatedefinition/index.html index 53d3d0b301..fdfaa03ae8 100644 --- a/docs/next/api/validatedefinition/index.html +++ b/docs/next/api/validatedefinition/index.html @@ -7,13 +7,13 @@ - +
Version: Next

validateDefinition

text​

export type validateDefinition<def, $> = [def] extends [(...args: any[]) => any]
? def
: def extends Terminal
? def
: def extends string
? validateString<def, $>
: def extends TupleExpression
? validateTupleExpression<def, $>
: def extends BadDefinitionType
? writeBadDefinitionTypeMessage<
objectKindOf<def> extends string ? objectKindOf<def> : domainOf<def>
>
: isUnknown<def> extends true
? stringKeyOf<$>
: evaluate<{
[k in keyof def]: validateDefinition<def[k], $>
}>
- + \ No newline at end of file diff --git a/docs/next/api/validatedivisor/index.html b/docs/next/api/validatedivisor/index.html index 609f274c68..977ae04d7f 100644 --- a/docs/next/api/validatedivisor/index.html +++ b/docs/next/api/validatedivisor/index.html @@ -7,13 +7,13 @@ - +
Version: Next

validateDivisor

operator​

string​

  • "N%D", where "N" is a number and "D" is a non-zero integer
- + \ No newline at end of file diff --git a/docs/next/api/validationscope/index.html b/docs/next/api/validationscope/index.html index d0acea4647..5db40fce49 100644 --- a/docs/next/api/validationscope/index.html +++ b/docs/next/api/validationscope/index.html @@ -7,13 +7,13 @@ - +
Version: Next

validationScope

keywords​

  • keywords: { "alpha": "only letters", "alphanumeric": "only letters and digits", "lowercase": "only lowercase letters", "uppercase": "only uppercase letters", "creditCard": "a valid credit card number", "email": "a valid email", "uuid": "a valid UUID", "parsedNumber": "a well-formed numeric string", "parsedInteger": "a well-formed integer string", "parsedDate": "a valid date", "semver": "a valid semantic version", "json": "a JSON-parsable string", "integer": "an integer"}

text​

NameTypeDescription
alpha stringonly letters
alphanumeric stringonly letters and digits
lowercase stringonly lowercase letters
uppercase stringonly uppercase letters
creditCard stringa valid credit card number
email stringa valid email
uuid stringa valid UUID
parsedNumber (In: string) => import("../../parse/ast/morph.js").Out<number>a well-formed numeric string
parsedInteger (In: string) => import("../../parse/ast/morph.js").Out<number>a well-formed integer string
parsedDate (In: string) => import("../../parse/ast/morph.js").Out<Date>a valid date
semver stringa valid semantic version
json (In: string) => import("../../parse/ast/morph.js").Out<unknown>a JSON-parsable string
integer numberan integer
- + \ No newline at end of file diff --git a/docs/next/api/valueof/index.html b/docs/next/api/valueof/index.html index 481a490ef8..6c0e7428f6 100644 --- a/docs/next/api/valueof/index.html +++ b/docs/next/api/valueof/index.html @@ -7,13 +7,13 @@ - +
Version: Next

valueOf

operator​

tuple​

  • ["===", T]
  • const tupleValueOf = type(["valueOf", {a:"string"}])

helper​

  • valueOf(T)
  • const helperValueOf = valueOf({a:"string"})
- + \ No newline at end of file diff --git a/docs/next/index.html b/docs/next/index.html index 2fd850fc2e..5d972a1e04 100644 --- a/docs/next/index.html +++ b/docs/next/index.html @@ -7,13 +7,13 @@ - +
Version: Next

Getting Started

Install 📦12KB gzipped, 0 dependencies​

Npm Icon npm install arktype(or whatever package manager you prefer)

Our types are tested in strict-mode with TypeScript versions 4.8, 4.9, and 5.0.

Our APIs have mostly stabilized, but details may still change during the alpha/beta stages of our 1.0 release. If you have suggestions that may require a breaking change, now is the time to let us know! ⛵

Your first type​

- + \ No newline at end of file diff --git a/docs/next/scopes/index.html b/docs/next/scopes/index.html index 98d1564559..70a52c615b 100644 --- a/docs/next/scopes/index.html +++ b/docs/next/scopes/index.html @@ -7,13 +7,13 @@ - +
Version: Next

Scopes

- + \ No newline at end of file diff --git a/docs/scopes/index.html b/docs/scopes/index.html index 3cb00d2cd8..07f46a55a6 100644 --- a/docs/scopes/index.html +++ b/docs/scopes/index.html @@ -7,13 +7,13 @@ - +
Version: 1.0.28-alpha

Scopes

- + \ No newline at end of file diff --git a/index.html b/index.html index 5788d7a909..dc620bb7f7 100644 --- a/index.html +++ b/index.html @@ -7,13 +7,13 @@ - +

ArkType

TypeScript's 1:1 validator, optimized from editor to runtime

typescript@4.9.5 in VS Code— no extensions or plugins required (how?)
npm install arktype

ArkType is a runtime validation library that can infer TypeScript definitions 1:1 and reuse them as highly-optimized validators for your data.

With each character you type, you'll get immediate feedback from your editor in the form of either a fully-inferred Type or a specific and helpful ParseError.

This result exactly mirrors what you can expect to happen at runtime down to the punctuation of the error message- no plugins required.

Isomorphic

Define types using TS syntax. Infer them 1:1. Use them to validate your data at runtime.

const user = type({
name: "string",
device: {
platform: "'android'|'ios'",
"version?": "number"
}
})


// Hover to infer...
type User = typeof user.infer

Concise

Say more with less

// Hover to infer...
const arkUser = type({
name: /^ark.*$/ as Infer<`ark${string}`>,
birthday: morph("string", (s) => new Date(s)),
"powerLevel?": "1<=number<9000"
})
// Hover to infer...
const zodUser = z.object({
name: z.custom<`zod${string}`>(
(val) => typeof val === "string" && /^zod.*$/.test(val)
),
birthday: z.preprocess(
(arg) => (typeof arg === "string" ? new Date(arg) : undefined),
z.date()
),
powerLevel: z.number().gte(1).lt(9000).optional()
})

Optimized

ArkType is not just a validator— it's a full type system. Operations are deeply computed and optimized by default

// Hover to see internal representation...
export const deepLeftOrRight = union(
{
auto: {
discriminated: "'left'"
}
},
{
auto: {
discriminated: "'right'"
}
}
)
// Hover to see internal representation...
export const numericIntersection = type(
"(1 <= number%2 < 100) & (0 < number%3 <= 99)"
)





Type-safe

String definitions are statically parsed with each character you type and give detailed feedback just like in your editor.

Worried about performance? Don't be. This is how it feels to interact with a scope of 100 cyclic types (you may want to go fullscreen to see the details!)
- + \ No newline at end of file diff --git a/try/index.html b/try/index.html index c2388ae1f2..2884cc51de 100644 --- a/try/index.html +++ b/try/index.html @@ -7,13 +7,13 @@ - +

ArkType

TypeScript's 1:1 validator, optimized from editor to runtime

typescript@4.9.5 in VS Code— no extensions or plugins required (how?)
npm install arktype

ArkType is a runtime validation library that can infer TypeScript definitions 1:1 and reuse them as highly-optimized validators for your data.

With each character you type, you'll get immediate feedback from your editor in the form of either a fully-inferred Type or a specific and helpful ParseError.

This result exactly mirrors what you can expect to happen at runtime down to the punctuation of the error message- no plugins required.

Isomorphic

Define types using TS syntax. Infer them 1:1. Use them to validate your data at runtime.

const user = type({
name: "string",
device: {
platform: "'android'|'ios'",
"version?": "number"
}
})


// Hover to infer...
type User = typeof user.infer

Concise

Say more with less

// Hover to infer...
const arkUser = type({
name: /^ark.*$/ as Infer<`ark${string}`>,
birthday: morph("string", (s) => new Date(s)),
"powerLevel?": "1<=number<9000"
})
// Hover to infer...
const zodUser = z.object({
name: z.custom<`zod${string}`>(
(val) => typeof val === "string" && /^zod.*$/.test(val)
),
birthday: z.preprocess(
(arg) => (typeof arg === "string" ? new Date(arg) : undefined),
z.date()
),
powerLevel: z.number().gte(1).lt(9000).optional()
})

Optimized

ArkType is not just a validator— it's a full type system. Operations are deeply computed and optimized by default

// Hover to see internal representation...
export const deepLeftOrRight = union(
{
auto: {
discriminated: "'left'"
}
},
{
auto: {
discriminated: "'right'"
}
}
)
// Hover to see internal representation...
export const numericIntersection = type(
"(1 <= number%2 < 100) & (0 < number%3 <= 99)"
)





Type-safe

String definitions are statically parsed with each character you type and give detailed feedback just like in your editor.

Worried about performance? Don't be. This is how it feels to interact with a scope of 100 cyclic types (you may want to go fullscreen to see the details!)
- + \ No newline at end of file