Closed akshaybabloo closed 3 years ago
Using KV variables, example FOO.get('var'), would give a webpack error.
FOO.get('var')
> worker-typescript-template@1.0.0 build > webpack asset worker.js 2.33 KiB [emitted] (name: main) 1 related asset ./src/index.ts 219 bytes [built] [code generated] ./src/handler.ts 519 bytes [built] [code generated] [1 error] ERROR in /Users/akshayrajgollahalli/Documents/GitHub/cloudflare-workers/gollahalli-com-delete-history/src/handler.ts ./src/handler.ts 7:24-34 [tsl] ERROR in /Users/akshayrajgollahalli/Documents/GitHub/cloudflare-workers/gollahalli-com-delete-history/src/handler.ts(7,25) TS2304: Cannot find name 'FOO'. ts-loader-default_e3b0c44298fc1c14 @ ./src/index.ts 3:18-38 webpack 5.38.1 compiled with 1 error in 1649 ms
Is there a way to get over this?
declare var FOO: KVNamespace
https://www.typescriptlang.org/docs/handbook/declaration-files/by-example.html#global-variables
https://github.com/cloudflare/workers-types/blob/master/index.d.ts#L582
Thank you @koeninger
Just as a follow up question, Where does the KVNameSpace type live?
it's in the workers-types project I linked above
Using KV variables, example
FOO.get('var')
, would give a webpack error.Is there a way to get over this?