-
-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: disallow scope-level typed configs (#1271)
- Loading branch information
1 parent
949e4fa
commit b227e45
Showing
33 changed files
with
586 additions
and
303 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,45 @@ | ||
import { ArrowRightIcon } from "lucide-react" | ||
import Link from "next/link" | ||
import { AutoplayDemo } from "./AutoplayDemo.tsx" | ||
import { MainAutoplayDemo } from "./AutoplayDemo.tsx" | ||
import { PlatformCloud } from "./PlatformCloud.tsx" | ||
|
||
export const Hero = () => ( | ||
<div className="flex flex-col md:flex-row justify-between"> | ||
<div className="absolute top-2 left-0 right-0"> | ||
<div className="flex justify-between"> | ||
<PlatformCloud main="ts" right="vscode" top="neovim" left="intellij" /> | ||
<PlatformCloud main="js" right="chromium" top="node" left="bun" /> | ||
<div> | ||
<div className="flex flex-col md:flex-row justify-between"> | ||
<div className="absolute top-2 left-0 right-0"> | ||
<div className="flex justify-between"> | ||
<PlatformCloud | ||
main="ts" | ||
right="vscode" | ||
top="neovim" | ||
left="intellij" | ||
/> | ||
<PlatformCloud main="js" right="chromium" top="node" left="bun" /> | ||
</div> | ||
</div> | ||
|
||
<div className="relative w-full flex flex-col md:items-start text-center md:text-left"> | ||
<h1 className="mb-4 text-3xl md:text-8xl">ArkType</h1> | ||
<p className="text-fd-muted-foreground text-2xl leading-relaxed"> | ||
Optimized runtime validation from familiar, type-safe syntax. | ||
</p> | ||
|
||
{/* This wrapper grows to fill remaining vertical space, placing the link in the centered area */} | ||
<div className="flex-1 flex items-center justify-center md:justify-start mt-6"> | ||
<Link | ||
tabIndex={1} | ||
href="/docs/intro/setup" | ||
className="bg-highlight text-black focus-within:outline focus-within:outline-2 outline-white hover:bg-highlight/80 p-5 rounded-full flex gap-2 text-sm items-center" | ||
> | ||
Set Sail | ||
<ArrowRightIcon /> | ||
</Link> | ||
</div> | ||
</div> | ||
|
||
<div style={{ padding: "2rem", position: "relative" }}> | ||
<MainAutoplayDemo /> | ||
</div> | ||
</div> | ||
<div className="relative w-full flex flex-col items-center text-center md:items-start md:text-left"> | ||
<h1 className="mb-4 text-3xl md:text-8xl">ArkType</h1> | ||
<p className="text-fd-muted-foreground text-lg"> | ||
Typescript's 1:1 validator, optimized from editor to runtime | ||
</p> | ||
<Link | ||
tabIndex={1} | ||
href="/docs/intro/setup" | ||
className="bg-highlight text-black focus-within:outline focus-within:outline-2 outline-white hover:bg-highlight/80 p-5 rounded-full w-fit flex gap-2 my-3 text-sm items-center" | ||
> | ||
Set Sail | ||
<ArrowRightIcon /> | ||
</Link> | ||
</div> | ||
<div style={{ padding: "2rem", position: "relative" }}> | ||
<AutoplayDemo src="https://github.com/user-attachments/assets/895c439e-fcd3-4420-93fa-299e829fcf26" /> | ||
</div> | ||
</div> | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,18 @@ | ||
import { type } from "arktype" | ||
import { scope, type } from "arktype" | ||
|
||
const user = type({ | ||
name: "string", | ||
data: "number | (bigint | string)[]" | ||
const myScope = scope( | ||
{ user: { age: "number < 100" } }, | ||
{ | ||
max: { | ||
actual: () => "unacceptably large" | ||
} | ||
} | ||
) | ||
const types = myScope.export() | ||
// ArkErrors: age must be less than 100 (was unacceptably large) | ||
types.user({ name: "Alice", age: 101 }) | ||
const parsedAfter = myScope.type({ | ||
age: "number <= 100" | ||
}) | ||
|
||
export type User = typeof user.infer | ||
// ArkErrors: age must be at most 100 (was unacceptably large) | ||
parsedAfter({ age: 101 }) |
Oops, something went wrong.