yusukebe / pico

Ultra-tiny router for Cloudflare Workers and Deno
https://www.npmjs.com/package/@picojs/pico
MIT License
166 stars 5 forks source link

declare global Env type #9

Closed FlatMapIO closed 1 year ago

FlatMapIO commented 1 year ago

Currently, the wrangler create project comes with a worker-configuration.d.ts file by default. I added a global namespace Env type for Pico so that it can be merged with the user's local Env and provide type awareness in the env parameter.

interface Env {
    // Example binding to KV. Learn more at https://developers.cloudflare.com/workers/runtime-apis/kv/
    // MY_KV_NAMESPACE: KVNamespace;
    //
    // Example binding to Durable Object. Learn more at https://developers.cloudflare.com/workers/runtime-apis/durable-objects/
    // MY_DURABLE_OBJECT: DurableObjectNamespace;
    //
    // Example binding to R2. Learn more at https://developers.cloudflare.com/workers/runtime-apis/r2/
    // MY_BUCKET: R2Bucket;
    //
    // Example binding to a Service. Learn more at https://developers.cloudflare.com/workers/runtime-apis/service-bindings/
    // MY_SERVICE: Fetcher;
    //
    // Example binding to a Queue. Learn more at https://developers.cloudflare.com/queues/javascript-apis/
    // MY_QUEUE: Queue;
    API_KEY: string
    SEB: SendEmail
}
image