udacity / cloudflare-typescript-workers

Types and mocks for building a tested Typescript Cloudflare Worker, generates three NPM packages
Apache License 2.0
139 stars 12 forks source link

CloudflareWorkerKV type has incorrect function definition for KV.delete #30

Closed marcelduin closed 3 years ago

marcelduin commented 3 years ago

https://github.com/udacity/cloudflare-typescript-workers/blob/57171c327149e48e85e1ad26cfe6fc4c485fa68f/packages/types-cloudflare-worker/src/global.ts#L653

In the actual KV API, KV.delete is async. In the definitions file, it is not. Using KV in a TypeScript project generates incorrect errors using the current definitions file.

To fix it, change R653 in the above reference to

delete(key: string): Promise<void>;
13rac1 commented 3 years ago

Ahh, must have been changed. Thanks! I wish this were the official definitions.