Skip to content

Commit ca978d9

Browse files
committed
refactor: manually write index.d.ts for now
Refs: denoland/deno#3385
1 parent 2cf1af2 commit ca978d9

File tree

2 files changed

+28
-6
lines changed

2 files changed

+28
-6
lines changed

index.d.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
interface Result {
2+
name: 'AssertionError' | 'AssertionResult'
3+
ok: boolean
4+
toJSON(...args: unknown[]): Record<string, unknown>
5+
}
6+
7+
declare class AssertionError<T> extends Error implements Result {
8+
[key: string]: unknown;
9+
name: 'AssertionError';
10+
ok: false;
11+
message: string;
12+
constructor(message: string, props?: T, ssf?: Function);
13+
stack: string;
14+
toJSON(stack?: boolean): Record<string, unknown>;
15+
}
16+
17+
declare class AssertionResult<T> implements Result {
18+
[key: string]: unknown;
19+
name: 'AssertionResult';
20+
ok: true;
21+
message: string;
22+
constructor(props?: T);
23+
toJSON(): Record<string, unknown>;
24+
}
25+
26+
export {Result, AssertionError, AssertionResult}

mod.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
1+
import {Result} from './index.d.ts'
2+
13
const canElideFrames = "captureStackTrace" in Error;
24
const startStackFrames = new WeakMap();
35

4-
interface Result {
5-
name: "AssertionError" | "AssertionResult";
6-
ok: boolean;
7-
toJSON(...args: unknown[]): Record<string, unknown>;
8-
}
9-
106
export class AssertionError<T> extends Error implements Result {
117
[key: string]: unknown
128

0 commit comments

Comments
 (0)