Skip to content

Commit 57597ae

Browse files
committed
feat: added stricter types
1 parent 26c8053 commit 57597ae

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

src/index.d.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1558,7 +1558,7 @@ export type SAHPoolUtil = {
15581558
/** Exception class for reporting WASM-side allocation errors. */
15591559
export class WasmAllocError extends Error {
15601560
constructor(message: string);
1561-
toss: any;
1561+
toss: (...args: unknown[]) => never;
15621562
}
15631563

15641564
/** Exception class used primarily by the oo1 API. */
@@ -1581,7 +1581,7 @@ interface Worker1MessageBusEnvelope {
15811581
* Optional arbitrary value. The worker will copy it as-is into response
15821582
* messages to assist in client-side dispatching.
15831583
*/
1584-
messageId?: any;
1584+
messageId?: unknown;
15851585

15861586
/**
15871587
* A db identifier string (returned by 'open') which tells the operation which
@@ -1594,7 +1594,7 @@ interface Worker1MessageBusEnvelope {
15941594
/** Worker API #1 input message envelope. */
15951595
interface Worker1InputEnvelope<
15961596
T extends string,
1597-
Args = any,
1597+
Args = unknown,
15981598
> extends Worker1MessageBusEnvelope {
15991599
type: T;
16001600
args?: Args;
@@ -1605,7 +1605,7 @@ interface Worker1InputEnvelope<
16051605
/** Worker API #1 output message envelope. */
16061606
interface Worker1OutputEnvelope<
16071607
T extends string,
1608-
Result = any,
1608+
Result = unknown,
16091609
> extends Worker1MessageBusEnvelope {
16101610
type: T;
16111611
result: Result;
@@ -1644,7 +1644,7 @@ interface Worker1ErrorResult {
16441644
/** The ErrorClass.name property from the thrown exception. */
16451645
errorClass: string;
16461646
/** The message object which triggered the error. */
1647-
input: any;
1647+
input: Worker1InputEnvelope<string, unknown>;
16481648
/** If available, a stack trace array. */
16491649
stack?: string[];
16501650
}
@@ -1770,13 +1770,13 @@ interface Worker1PromiserConfig {
17701770
onunhandled?: (event: MessageEvent) => void;
17711771

17721772
/** Optional function to generate unique message IDs. */
1773-
generateMessageId?: (msg: any) => string;
1773+
generateMessageId?: (msg: Worker1InputEnvelope<string, unknown>) => string;
17741774

17751775
/** Optional debug logging function. */
1776-
debug?: (...args: any[]) => void;
1776+
debug?: (...args: unknown[]) => void;
17771777

17781778
/** Optional error logging function (undocumented). */
1779-
onerror?: (...args: any[]) => void;
1779+
onerror?: (...args: unknown[]) => void;
17801780
}
17811781

17821782
/** Factory for creating Worker1Promiser instances. */

0 commit comments

Comments
 (0)