@ark/attest 0.29.0 → 0.31.0
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { snapshot, type Constructor } from "@ark/util";
|
|
1
|
+
import { snapshot, type Constructor, type ErrorType, type isDisjoint } from "@ark/util";
|
|
2
2
|
import { type } from "arktype";
|
|
3
3
|
import type { Completions } from "../cache/writeAssertionCache.ts";
|
|
4
4
|
import type { AssertionContext } from "./attest.ts";
|
|
@@ -52,13 +52,19 @@ type snapProperty<expected, kind extends AssertionKind> = {
|
|
|
52
52
|
unwrap: Unwrapper<expected>;
|
|
53
53
|
};
|
|
54
54
|
export type Unwrapper<expected = unknown> = (opts?: UnwrapOptions) => expected;
|
|
55
|
+
export declare const nonOverlappingSatisfiesMessage = "The type of your actual value and expected satisfies constraint have no overlap";
|
|
56
|
+
export type nonOverlappingSatisfiesMessage = typeof nonOverlappingSatisfiesMessage;
|
|
57
|
+
type validateExpectedOverlaps<expected, satisfies> = isDisjoint<expected, satisfies> extends true ? ErrorType<nonOverlappingSatisfiesMessage, {
|
|
58
|
+
actual: expected;
|
|
59
|
+
satisfies: satisfies;
|
|
60
|
+
}> : unknown;
|
|
55
61
|
export type comparableValueAssertion<expected, kind extends AssertionKind> = {
|
|
56
62
|
snap: snapProperty<expected, kind>;
|
|
57
63
|
equals: (value: expected) => nextAssertions<kind>;
|
|
58
64
|
instanceOf: (constructor: Constructor) => nextAssertions<kind>;
|
|
59
65
|
is: (value: expected) => nextAssertions<kind>;
|
|
60
66
|
completions: CompletionsSnap;
|
|
61
|
-
satisfies: <def>(def: type.validate<def>) => nextAssertions<kind>;
|
|
67
|
+
satisfies: <const def>(def: type.validate<def> & validateExpectedOverlaps<expected, type.infer.In<def>>) => nextAssertions<kind>;
|
|
62
68
|
unknown: Omit<comparableValueAssertion<unknown, kind>, "unknown">;
|
|
63
69
|
unwrap: Unwrapper<expected>;
|
|
64
70
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ark/attest",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.31.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "David Blass",
|
|
@@ -32,13 +32,13 @@
|
|
|
32
32
|
"attest": "out/cli/cli.js"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@typescript/vfs": "1.6.0",
|
|
36
|
-
"@typescript/analyze-trace": "0.10.1",
|
|
37
|
-
"prettier": "3.3.3",
|
|
38
35
|
"@prettier/sync": "0.5.2",
|
|
39
|
-
"
|
|
40
|
-
"@
|
|
41
|
-
"
|
|
36
|
+
"@typescript/analyze-trace": "0.10.1",
|
|
37
|
+
"@typescript/vfs": "1.6.0",
|
|
38
|
+
"prettier": "3.4.2",
|
|
39
|
+
"arktype": "2.0.0-rc.27",
|
|
40
|
+
"@ark/util": "0.27.0",
|
|
41
|
+
"@ark/fs": "0.27.0"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"typescript": "5.7.1-rc"
|