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

9: Add func type definition for KV list() #10

Closed dhaynespls closed 4 years ago

dhaynespls commented 4 years ago

Closes #9

13rac1 commented 4 years ago

Thanks for the contribution! The mock package build is failing with:

src/index.ts:80:9 - error TS2741: Property 'list' is missing in type '{ get(_key: string, _type?: "json" | "text" | "arrayBuffer" | "stream" | undefined): Promise<any>; put(_key: string, _value: string | ArrayBuffer | FormData | ReadableStream<any>): Promise<...>; delete(_key: string): Promise<...>; }' but required in type 'CloudflareWorkerKV'.

80   const cloudflareWorkerKV: CloudflareWorkerKV = {
           ~~~~~~~~~~~~~~~~~~

  node_modules/types-cloudflare-worker/global.d.ts:518:5
    518     list(prefix?: string, limit?: number, cursor?: string): Promise<{
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    519         keys: {
        ~~~~~~~~~~~~~~~
    ... 
    524         cursor: string;
        ~~~~~~~~~~~~~~~~~~~~~~~
    525     }>;
        ~~~~~~~
    'list' is declared here.

To test, make changes then run:

npm run lint-fix
npm run packages
npm i
npm test
13rac1 commented 4 years ago

I've added a new commit to this in #11 I'm not sure why the CircleCI test isn't running. Perhaps it requires you have an account? :thinking: