@ark/attest 0.27.0 → 0.28.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.
@@ -49,24 +49,30 @@ export type valueFromTypeAssertion<expected, chained = expected> = inferredAsser
49
49
  type snapProperty<expected, kind extends AssertionKind> = {
50
50
  (expected?: snapshot<expected>): nextAssertions<kind>;
51
51
  toFile: (id: string, options?: ExternalSnapshotOptions) => nextAssertions<kind>;
52
+ unwrap: Unwrapper<expected>;
52
53
  };
54
+ export type Unwrapper<expected = unknown> = (opts?: UnwrapOptions) => expected;
53
55
  export type comparableValueAssertion<expected, kind extends AssertionKind> = {
54
56
  snap: snapProperty<expected, kind>;
55
57
  equals: (value: expected) => nextAssertions<kind>;
56
58
  instanceOf: (constructor: Constructor) => nextAssertions<kind>;
57
59
  is: (value: expected) => nextAssertions<kind>;
58
- completions: (value?: Completions) => void;
60
+ completions: CompletionsSnap;
59
61
  satisfies: <def>(def: type.validate<def>) => nextAssertions<kind>;
60
62
  unknown: Omit<comparableValueAssertion<unknown, kind>, "unknown">;
61
- unwrap: (opts?: UnwrapOptions) => unknown;
63
+ unwrap: Unwrapper<expected>;
62
64
  };
65
+ export interface CompletionsSnap {
66
+ (value?: Completions): void;
67
+ unwrap: Unwrapper<Completions>;
68
+ }
63
69
  export type TypeAssertionsRoot = {
64
70
  type: TypeAssertionProps;
65
71
  };
66
72
  export type TypeAssertionProps = {
67
73
  toString: valueFromTypeAssertion<string | RegExp>;
68
74
  errors: valueFromTypeAssertion<string | RegExp, string>;
69
- completions: (value?: Completions) => void;
75
+ completions: CompletionsSnap;
70
76
  };
71
77
  export type ExternalSnapshotOptions = {
72
78
  path?: string;
@@ -103,7 +103,10 @@ export class ChainableAssertions {
103
103
  assertEquals(expectedSnapshot, this.serializedActual, this.ctx);
104
104
  return this;
105
105
  };
106
- return Object.assign(inline, { toFile });
106
+ return Object.assign(inline, {
107
+ toFile,
108
+ unwrap: this.unwrap.bind(this)
109
+ });
107
110
  }
108
111
  immediateOrChained() {
109
112
  const immediateAssertion = (...args) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ark/attest",
3
- "version": "0.27.0",
3
+ "version": "0.28.0",
4
4
  "license": "MIT",
5
5
  "author": {
6
6
  "name": "David Blass",
@@ -36,12 +36,12 @@
36
36
  "@typescript/analyze-trace": "0.10.1",
37
37
  "prettier": "3.3.3",
38
38
  "@prettier/sync": "0.5.2",
39
- "arktype": "2.0.0-rc.23",
40
- "@ark/util": "0.23.0",
41
- "@ark/fs": "0.23.0"
39
+ "@ark/fs": "0.24.0",
40
+ "arktype": "2.0.0-rc.24",
41
+ "@ark/util": "0.24.0"
42
42
  },
43
43
  "devDependencies": {
44
- "typescript": "5.7.0-beta"
44
+ "typescript": "5.7.1-rc"
45
45
  },
46
46
  "peerDependencies": {
47
47
  "typescript": "*"