Skip to content

Commit

Permalink
chore: update versions (arktypeio#719)
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Apr 18, 2023
1 parent d927a8e commit c5e9795
Show file tree
Hide file tree
Showing 55 changed files with 1,336 additions and 33 deletions.
25 changes: 25 additions & 0 deletions CHANGELOG.md
@@ -1,5 +1,30 @@
# arktype

## 1.0.14-alpha

### Patch Changes

- ## add a syntax error when defining an expression with multiple right bounds

Ensures expressions like the following result in a syntax error during type validation (will currently not throw at runtime):

```ts
// Type Error: `Expression 'number' must have at most one right bound`
const boundedNumber = type("number>0<=200")
```

- ## fix array validation in strict and distilled modes

Previously, attempting to validate an array with "keys" set to "distilled" or "strict" would yield incorrect results.

Now, types like this behave as expected:

```ts
const strictArray = type("string[]", { keys: "strict" })
// data = ["foo", "bar"]
const { data, problems } = strictArray(["foo", "bar"])
```

## 1.0.13-alpha

### Patch Changes
Expand Down
Expand Up @@ -39,7 +39,7 @@ export const createStackblitzDemo = async ({ embedId }: DemoProps) =>
template: "typescript",
dependencies: {
// @lineFrom:package.json:version |> embed("arktype":,,)
arktype: "1.0.13-alpha"
arktype: "1.0.14-alpha"
},
settings: {
compile: {
Expand Down
Expand Up @@ -15,4 +15,4 @@ hide_table_of_contents: true

## example

- const isEven = (x: unknown): x is number => x % 2 === 0
- const isEven = (x: unknown): x is number => x % 2 === 0
Expand Up @@ -15,4 +15,4 @@ hide_table_of_contents: true

## example

- const isEven = (x: unknown): x is number => x % 2 === 0
- const isEven = (x: unknown): x is number => x % 2 === 0
Expand Up @@ -15,4 +15,4 @@ hide_table_of_contents: true

## example

- const isEven = (x: unknown): x is number => x % 2 === 0
- const isEven = (x: unknown): x is number => x % 2 === 0
15 changes: 15 additions & 0 deletions dev/arktype.io/versioned_docs/version-1.0.14-alpha/api.mdx
@@ -0,0 +1,15 @@
---
id: api
hide_table_of_contents: true
title: API
---

# API

<!-- @blockFrom:README.md:api |> replace(./dev/test,https://github.com/arktypeio/arktype/tree/main/dev/test) -->

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](https://github.com/arktypeio/arktype/tree/main/dev/test) or ask us [on Discord](https://discord.gg/WSNF3Kc4xh) if your functionality is supported. If not, [create a GitHub issue](https://github.com/arktypeio/arktype/issues/new) so we can prioritize it!

<!-- @blockEnd -->
11 changes: 11 additions & 0 deletions dev/arktype.io/versioned_docs/version-1.0.14-alpha/api/ark.md
@@ -0,0 +1,11 @@
---
hide_table_of_contents: true
---

# ark

## text

```ts
ark: Space<PrecompiledDefaults>
```
54 changes: 54 additions & 0 deletions dev/arktype.io/versioned_docs/version-1.0.14-alpha/api/arkscope.md
@@ -0,0 +1,54 @@
---
hide_table_of_contents: true
---

# arkScope

## text

```ts
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
]
>
```
24 changes: 24 additions & 0 deletions dev/arktype.io/versioned_docs/version-1.0.14-alpha/api/arrayof.md
@@ -0,0 +1,24 @@
---
hide_table_of_contents: true
---

# arrayOf

## operator

- [arrayOf](./arrayof.md)

## string

- "T[]" <br/>
- const numberArray = type("number[]")<br/>

## tuple

- [T, "[]"] <br/>
- const tupleArray = type(["number", "[]"])<br/>

## helper

- arrayOf(T) <br/>
- const helperArray = arrayOf("number")<br/>
13 changes: 13 additions & 0 deletions dev/arktype.io/versioned_docs/version-1.0.14-alpha/api/infer.md
@@ -0,0 +1,13 @@
---
hide_table_of_contents: true
---

# Infer

## text

```ts
export type Infer<t> = {
[as]?: t
}
```
@@ -0,0 +1,19 @@
---
hide_table_of_contents: true
---

# instanceOf

## operator

- [instanceOf](./instanceof.md)

## tuple

- ["instanceOf", T] <br/>
- const tupleInstanceOf = type(["instanceOf", Date])<br/>

## helper

- instanceOf(T) <br/>
- const helperInstanceOf = instanceOf(Date)<br/>
@@ -0,0 +1,24 @@
---
hide_table_of_contents: true
---

# intersection

## operator

- [&](./intersection.md)

## string

- "L&R" <br/>
- const intersection = type("/@arktype\.io$/ & email")<br/>

## tuple

- [L, "&", R] <br/>
- const tupleIntersection = type(["/@arktype\.io$/", "&", "email"])<br/>

## helper

- intersection(L,R) <br/>
- const helperIntersection = intersection("/@arktype\.io$/","email")<br/>
@@ -0,0 +1,19 @@
---
hide_table_of_contents: true
---

# jsObjectsScope

## text

| Name | Type | Description |
| -------- | ------------------------------ | ----------- |
| 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>` | |
19 changes: 19 additions & 0 deletions dev/arktype.io/versioned_docs/version-1.0.14-alpha/api/keyof.md
@@ -0,0 +1,19 @@
---
hide_table_of_contents: true
---

# keyOf

## operator

- [keyOf](./keyof.md)

## tuple

- "["keyOf", T]" <br/>
- const tupleKeyOf = type(["keyOf", {a:"string"}])<br/>

## helper

- keyOf(T) <br/>
- const helperKeyOf = keyOf({a:"string"})<br/>
56 changes: 56 additions & 0 deletions dev/arktype.io/versioned_docs/version-1.0.14-alpha/api/keywords.md
@@ -0,0 +1,56 @@
---
hide_table_of_contents: true
---

# Keywords

## jsObjectsScope

| Name | Type | Description |
| -------- | ------------------------------ | ----------- |
| 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

| Name | Type | Description |
| --------- | ------------ | ----------- |
| any | ` any` | any |
| bigint | ` bigint` | a bigint |
| boolean | ` boolean` | a boolean |
| false | ` false` | false |
| never | ` never` | never |
| null | ` null` | null |
| number | ` number` | a number |
| object | ` object` | an object |
| string | ` string` | a string |
| symbol | ` symbol` | a symbol |
| true | ` true` | true |
| unknown | ` unknown` | unknown |
| void | ` void` | void |
| undefined | ` undefined` | undefined |

## validationScope

| Name | Type | Description |
| ------------- | -------------------------- | ---------------------------- |
| alpha | ` string` | only letters |
| alphanumeric | ` string` | only letters and digits |
| lowercase | ` string` | only lowercase letters |
| uppercase | ` string` | only uppercase letters |
| creditCard | ` string` | a valid credit card number |
| email | ` string` | a valid email |
| uuid | ` string` | a valid UUID |
| parsedNumber | ` (In: string) => number` | a well-formed numeric string |
| parsedInteger | ` (In: string) => number` | a well-formed integer string |
| parsedDate | ` (In: string) => Date` | a valid date |
| semver | ` string` | a valid semantic version |
| json | ` (In: string) => unknown` | a JSON-parsable string |
| integer | ` number` | an integer |
19 changes: 19 additions & 0 deletions dev/arktype.io/versioned_docs/version-1.0.14-alpha/api/morph.md
@@ -0,0 +1,19 @@
---
hide_table_of_contents: true
---

# morph

## operator

- [&vert;>](./morph.md)

## tuple

- [inputType, "&vert;>", (data) => output] <br/>
- const tupleMorph = type( ["string", "&vert;>" , (data) => \`morphed ${data}\`])<br/>

## helper

- morph(inputType, (data) => output) <br/>
- const helperMorph = morph("string", (data) => \`morphed ${data}\`)<br/>
18 changes: 18 additions & 0 deletions dev/arktype.io/versioned_docs/version-1.0.14-alpha/api/narrow.md
@@ -0,0 +1,18 @@
---
hide_table_of_contents: true
---

# narrow

## operator

- [=>](./narrow.md)

## tuple

- ["type", "=>" , condition] <br/>
- const narrow = type( ["number", "=>" , (n) => n % 2 === 0])<br/>

## example

- const isEven = (x: unknown): x is number => x % 2 === 0
@@ -0,0 +1,22 @@
---
hide_table_of_contents: true
---

# Operators

## Operating Table

| operator | string | tuple | helper |
| ----------------------------- | ---------------------------------------------------------- | ---------------------------------------- | ---------------------------------- |
| [arrayOf](./arrayof.md) | "T[]" | [T, "[]"] | arrayOf(T) |
| [instanceOf](./instanceof.md) | | ["instanceOf", T] | instanceOf(T) |
| [&](./intersection.md) | "L&R" | [L, "&", R] | intersection(L,R) |
| [keyOf](./keyof.md) | | "["keyOf", T]" | keyOf(T) |
| [&vert;>](./morph.md) | | [inputType, "&vert;>", (data) => output] | morph(inputType, (data) => output) |
| [=>](./narrow.md) | | ["type", "=>" , condition] | |
| [&vert;](./union.md) | "L&vert;R" | [L, "&vert;" , R] | union(L,R) |
| [===](./valueof.md) | | ["===", T] | valueOf(T) |
| [:](./parseconfigtuple.md) | | ["type", ":", config] | |
| [bound](./validatebound.md) | "N<S<N", with comparators restricted to < or <= | | |
| [%](./validatedivisor.md) | "N%D", where "N" is a number and "D" is a non-zero integer | | |
| [node](./resolvednode.md) | | ["node", nodeDefinition] | type.from(nodeDefinition) |
@@ -0,0 +1,13 @@
---
hide_table_of_contents: true
---

# parseConfigTuple

## operator

- [:](./parseconfigtuple.md)

## tuple

- ["type", ":", config]

0 comments on commit c5e9795

Please sign in to comment.