Skip to content

Commit 3ad19d5

Browse files
authored
2.2.0 (#1594)
1 parent 6758030 commit 3ad19d5

30 files changed

Lines changed: 2114 additions & 124 deletions

File tree

.cursor/commands/armstrong.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
senator armstrong is reviewing the work on the current branch and he's angry. he will destroy both of us if he finds a single flaw. think big picture and iterate ruthlessly, fundamentally improving the design and implementation. once you are absolutely certain we won't be brutalized, report why senator armstrong will approve of the current changes using as many memes as possible. our fate is in your hands.

.github/workflows/pullfrog.yml

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,35 @@
11
# PULLFROG ACTION — DO NOT EDIT EXCEPT WHERE INDICATED
22
name: Pullfrog
3+
run-name: ${{ inputs.name || github.workflow }}
34
on:
45
workflow_dispatch:
56
inputs:
67
prompt:
78
type: string
89
description: Agent prompt
9-
workflow_call:
10-
inputs:
11-
prompt:
12-
description: Agent prompt
10+
name:
1311
type: string
14-
secrets: inherit
12+
description: Run name
1513

1614
permissions:
1715
id-token: write
16+
contents: write
17+
pull-requests: write
18+
issues: write
19+
actions: read
20+
checks: read
1821

1922
jobs:
20-
agent:
23+
pullfrog:
2124
runs-on: ubuntu-latest
2225
steps:
23-
- uses: actions/checkout@v4
26+
- name: Checkout code
27+
uses: actions/checkout@v6
28+
with:
29+
fetch-depth: 1
2430

2531
- name: Run agent
26-
uses: pullfrog/action@main
32+
uses: pullfrog/pullfrog@v0
2733
with:
2834
prompt: ${{ inputs.prompt }}
2935
env:

ark/attest/__tests__/assertions.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { attest } from "@ark/attest"
22
import { MissingSnapshotError } from "@ark/attest/internal/assert/assertions.ts"
33
import { attestInternal } from "@ark/attest/internal/assert/attest.ts"
4-
import { registeredReference } from "@ark/schema"
54
import { register } from "@ark/util"
65
import { type } from "arktype"
76
import * as assert from "node:assert/strict"

ark/docs/content/docs/blog/2.1.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ const out = User({
185185
})
186186
```
187187

188-
The options you can provide here are identical to those used to [configure a Type directly](https://arktype.io/docs/expressions#meta), and can also be [extended at a type-level to include custom metadata](https://arktype.io/docs/configuration#custom).
188+
The options you can provide here are identical to those used to [configure a Type directly](https://arktype.io/docs/expressions#meta), and can also be [extended at a type-level to include custom metadata](https://arktype.io/docs/configuration#metadata).
189189

190190
### Tuple and args expressions for `.to`
191191

Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
---
2+
title: ArkType 2.2 Twitter/X Thread
3+
---
4+
5+
# ArkType 2.2 Twitter/X Thread
6+
7+
---
8+
9+
**1/**
10+
11+
ArkType 2.2 is out.
12+
13+
Validated functions, type-safe regex, bidirectional JSON Schema, and universal schema interop.
14+
15+
Here's what's new 🧵
16+
17+
---
18+
19+
**2/**
20+
21+
type.fn
22+
23+
Define runtime-validated functions using the same syntax you already know.
24+
25+
```ts
26+
const len = type.fn("string | unknown[]", ":", "number")(s => s.length)
27+
28+
len("foo") // 3
29+
len([1, 2]) // 2
30+
```
31+
32+
Defaults, optionals, variadics- it all works.
33+
34+
---
35+
36+
**3/**
37+
38+
Type-safe regex via arkregex
39+
40+
Regex literals in your definitions now carry full type inference. x-prefix parses capture groups at runtime.
41+
42+
```ts
43+
const T = type({
44+
birthday: "x/^(?<month>\\d{2})-(?<day>\\d{2})-(?<year>\\d{4})$/"
45+
})
46+
47+
T.assert({ birthday: "05-21-1993" }).birthday.groups.month // "05"
48+
```
49+
50+
---
51+
52+
**4/**
53+
54+
Standard Schema validators can now be embedded directly in ArkType definitions.
55+
56+
Zod, Valibot, or anything else that implements the spec.
57+
58+
```ts
59+
const User = type({
60+
name: "string",
61+
age: "number",
62+
address: { street: "string" }
63+
})
64+
```
65+
66+
ArkType as a universal composition layer.
67+
68+
---
69+
70+
**5/**
71+
72+
@ark/json-schema
73+
74+
Bidirectional JSON Schema conversion. Parse JSON Schema into ArkType Types, and convert Types to JSON Schema.
75+
76+
Huge thanks to @TizzySaurus for building this one.
77+
78+
toJsonSchema() now supports configurable fallbacks, draft-07/2020-12 targets, and cyclic types.
79+
80+
---
81+
82+
**6/**
83+
84+
Configurable toJsonSchema
85+
86+
Not everything in ArkType maps cleanly to JSON Schema. Now you can handle incompatibilities your way.
87+
88+
```ts
89+
const T = type({
90+
birthday: "Date"
91+
})
92+
93+
T.toJsonSchema({
94+
fallback: {
95+
date: ctx => ({ ...ctx.base, type: "string", format: "date-time" }),
96+
default: ctx => ctx.base
97+
}
98+
})
99+
```
100+
101+
11 granular fallback codes.
102+
103+
---
104+
105+
**7/**
106+
107+
select + configure
108+
109+
Query your types by node kind and predicate. Use the same selectors to configure specific references.
110+
111+
```ts
112+
const myType = type("1 < number < 10")
113+
114+
const minNodes = myType.select("min")
115+
const exclusiveMins = minNodes.filter(n => n.exclusive)
116+
117+
myType.configure({ description: "a special domain" }, "domain")
118+
```
119+
120+
---
121+
122+
**8/**
123+
124+
Improved type.declare
125+
126+
Pre-declare your TS type, get compile-time errors when your definition doesn't match.
127+
128+
Now supports morph side declarations and optionality via property values.
129+
130+
```ts
131+
// type.declare<{ a: string }>().type({ a: "1" })
132+
// TS Error: declared: string; inferred: 1
133+
```
134+
135+
---
136+
137+
**9/**
138+
139+
More:
140+
141+
- type.or, type.and, type.merge, type.pipe - n-ary standalone operators
142+
- "|>" string-embeddable pipe syntax
143+
- type.valueOf for TS enums
144+
- string.hex + string.regex keywords
145+
- Serializable ArkErrors (flatByPath, flatProblemsByPath, toJSON)
146+
- TraversalError replaces AggregateError
147+
- exactOptionalPropertyTypes config
148+
- ES2020 + Hermes compatibility
149+
- In-docs playground
150+
- Better JSDoc + go-to-definition
151+
152+
---
153+
154+
**10/**
155+
156+
Full announcement: arktype.io/docs/blog/2.2
157+
158+
I couldn't be more hyped to see what you do with it.
159+
160+
⚡ arktype.io/docs/intro/setup
161+
⭐ github.com/arktypeio/arktype
162+
👋 arktype.io/discord
163+
164+
If you want to support this work: github.com/sponsors/arktypeio

0 commit comments

Comments
 (0)