Files
xixu-me 81e810ec9a Add type declarations and improve test typings
Introduces src/types.d.ts and test/types.d.ts for Cloudflare Workers and test utilities. Enhances JSDoc comments and type annotations across test files for better type safety and clarity. Updates tsconfig.json to use bundler module resolution and include additional type sources. Minor test logic and assertion improvements for robustness.
2025-12-08 19:57:48 +08:00

25 lines
682 B
TypeScript

/**
* Type declarations for cloudflare:test module
* Based on @cloudflare/vitest-pool-workers
*/
declare module 'cloudflare:test' {
/**
* Service binding to the default export defined in the `main` worker
*/
export const SELF: {
fetch(request: RequestInfo, init?: RequestInit): Promise<Response>;
fetch(url: string, init?: RequestInit): Promise<Response>;
};
/**
* Creates an instance of ExecutionContext for use in tests
*/
export function createExecutionContext(): ExecutionContext;
/**
* Waits for all ExecutionContext.waitUntil() promises to settle
*/
export function waitOnExecutionContext(ctx: ExecutionContext): Promise<void>;
}