RReverser / workers-types

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cloudflare Workers Types

Install

npm install --save-dev @cloudflare/workers-types
-- Or
yarn add -D @cloudflare/workers-types

Usage

Just supply an empty import in one of your source files to receive the workers types

import {} from '@cloudflare/workers-types'

Using a KV namespace

It's recommended that you create an ambient type file for your KV namespace bindings. Create a file named types.d.ts in your src directory:

types.d.ts

import { KVNamespace } from '@cloudflare/workers-types'

declare global {
  const myKVNamespace: KVNamespace
}

Now myKVNamespace is available to all of your source files.

About


Languages

Language:TypeScript 100.0%