arktype 2.0.0-dev.22 → 2.0.0-dev.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/out/ark.d.ts CHANGED
@@ -1,9 +1,10 @@
1
1
  import { type Ark, type ArkErrors, type inferred } from "@arktype/schema";
2
+ import type { CastableBase } from "@arktype/util";
2
3
  import type { Generic } from "./generic.js";
3
4
  import type { MatchParser } from "./match.js";
4
5
  import type { Module } from "./module.js";
5
6
  import { type Scope } from "./scope.js";
6
- import type { DeclarationParser, DefinitionParser, TypeParser } from "./type.js";
7
+ import type { DeclarationParser, DefinitionParser, Type, TypeParser } from "./type.js";
7
8
  type TsGenericsExports<$ = Ark> = {
8
9
  Record: Generic<[
9
10
  "K",
@@ -21,6 +22,12 @@ export declare namespace type {
21
22
  [inferred]?: t;
22
23
  };
23
24
  type errors = ArkErrors;
25
+ interface of<t, $ = {}> extends Type<t, $> {
26
+ }
27
+ interface infer<t extends Type<object>> extends CastableBase<t["infer"]> {
28
+ }
29
+ interface inferIn<t extends Type<object>> extends CastableBase<t["inferIn"]> {
30
+ }
24
31
  }
25
32
  export declare const match: MatchParser<{}>;
26
33
  export declare const define: DefinitionParser<{}>;
@@ -3,4 +3,4 @@ export type { Ark, ArkConfig, Out } from "@arktype/schema";
3
3
  export { ambient, ark, declare, define, match, type } from "./ark.js";
4
4
  export { Module } from "./module.js";
5
5
  export { scope, type Scope, type inferScope, type validateScope } from "./scope.js";
6
- export { Type, type inferTypeRoot, type validateTypeRoot } from "./type.js";
6
+ export { Type, type AnyType, type inferTypeRoot, type validateTypeRoot } from "./type.js";
@@ -1,4 +1,4 @@
1
- import { type BaseMeta, type BaseRoot, type Morph, type Out, type Predicate, type distillConstrainableIn, type distillConstrainableOut, type inferIntersection, type inferMorphOut, type inferPredicate } from "@arktype/schema";
1
+ import { type BaseMeta, type BaseRoot, type Morph, type Out, type Predicate, type distillConstrainableIn, type distillOut, type inferIntersection, type inferMorphOut, type inferPredicate } from "@arktype/schema";
2
2
  import { type Constructor, type Domain, type ErrorMessage, type array, type conform, type show } from "@arktype/util";
3
3
  import type { ParseContext } from "../scope.js";
4
4
  import type { inferDefinition, validateDefinition } from "./definition.js";
@@ -103,7 +103,7 @@ export type validatePostfixExpression<def extends PostfixExpression, $, args> =
103
103
  export type validateInfixExpression<def extends InfixExpression, $, args> = def["length"] extends 2 ? readonly [def[0], writeMissingRightOperandMessage<def[1]>] : readonly [
104
104
  validateDefinition<def[0], $, args>,
105
105
  def[1],
106
- def[1] extends "|" ? validateDefinition<def[2], $, args> : def[1] extends "&" ? validateDefinition<def[2], $, args> : def[1] extends ":" ? Predicate<distillConstrainableIn<inferDefinition<def[0], $, args>>> : def[1] extends "=>" ? Morph<distillConstrainableOut<inferDefinition<def[0], $, args>>, unknown> : def[1] extends "@" ? BaseMeta | string : validateDefinition<def[2], $, args>
106
+ def[1] extends "|" ? validateDefinition<def[2], $, args> : def[1] extends "&" ? validateDefinition<def[2], $, args> : def[1] extends ":" ? Predicate<distillOut<inferDefinition<def[0], $, args>>> : def[1] extends "=>" ? Morph<distillOut<inferDefinition<def[0], $, args>>, unknown> : def[1] extends "@" ? BaseMeta | string : validateDefinition<def[2], $, args>
107
107
  ];
108
108
  export type UnparsedTupleExpressionInput = {
109
109
  instanceof: Constructor;
package/out/type.d.ts CHANGED
@@ -69,6 +69,9 @@ export interface Type<
69
69
  out t = unknown, $ = {}> extends _Type<t, $> {
70
70
  }
71
71
  export type TypeConstructor<t = unknown, $ = {}> = new (def: unknown, $: Scope<$>) => Type<t, $>;
72
+ export type AnyType<
73
+ /** @ts-expect-error allow instantiation assignment to the base type */
74
+ out t = unknown, $ = any> = Type<t, $>;
72
75
  export declare const Type: TypeConstructor;
73
76
  export type DefinitionParser<$> = <def>(def: validateTypeRoot<def, $>) => def;
74
77
  export type validateTypeRoot<def, $ = {}> = validateDefinition<def, $, bindThis<def>>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "arktype",
3
3
  "description": "TypeScript's 1:1 validator, optimized from editor to runtime",
4
- "version": "2.0.0-dev.22",
4
+ "version": "2.0.0-dev.24",
5
5
  "license": "MIT",
6
6
  "author": {
7
7
  "name": "David Blass",
@@ -13,10 +13,10 @@
13
13
  "url": "https://github.com/arktypeio/arktype.git"
14
14
  },
15
15
  "type": "module",
16
- "main": "./out/api.js",
17
- "types": "./out/api.d.ts",
16
+ "main": "./out/index.js",
17
+ "types": "./out/index.d.ts",
18
18
  "exports": {
19
- ".": "./out/api.js",
19
+ ".": "./out/index.js",
20
20
  "./config": "./out/config.js",
21
21
  "./internal/*": "./out/*"
22
22
  },
@@ -24,8 +24,8 @@
24
24
  "out"
25
25
  ],
26
26
  "dependencies": {
27
- "@arktype/util": "0.0.48",
28
- "@arktype/schema": "0.1.14"
27
+ "@arktype/util": "0.0.49",
28
+ "@arktype/schema": "0.1.16"
29
29
  },
30
30
  "scripts": {
31
31
  "build": "tsx ../repo/build.ts",
File without changes