|
10 | 10 |
|
11 | 11 | ## 3.2.0
|
12 | 12 |
|
13 |
| -- **Add 'error' WebSocket event types overrides [@bretthoerner], [pull/143] & [pull/150]** |
| 13 | +- **Add 'error' WebSocket event types overrides [@bretthoerner], [pull/143] & [pull/150]** |
14 | 14 | - **Add PagesFunction type [@GregBrimble], [pull/154]**
|
15 | 15 | - **Updated types for 2021.11.400 [@autodecl-bot], [pull/145]**
|
16 | 16 | - **Updated types for 2021.11.700 [@autodecl-bot], [pull/149]**
|
|
76 | 76 |
|
77 | 77 | - **Add AVIF Format for Image Resizing - [@GregBrimble], [pull/59]**
|
78 | 78 |
|
79 |
| - [@GregBrimble]: https://github.com/GregBrimble |
| 79 | + [@gregbrimble]: https://github.com/GregBrimble |
80 | 80 | [pull/59]: https://github.com/cloudflare/workers-types/pull/59
|
81 | 81 |
|
82 | 82 | - **Add metadata typings for KV - [@GregBrimble], [pull/54]**
|
83 | 83 | Adds the [new metadata](https://developers.cloudflare.com/workers/runtime-apis/kv#metadata) types to the getWithMetadata, put and list methods on a KV namespace.
|
84 | 84 |
|
85 |
| - [@GregBrimble]: https://github.com/GregBrimble |
| 85 | + [@gregbrimble]: https://github.com/GregBrimble |
86 | 86 | [pull/54]: https://github.com/cloudflare/workers-types/pull/54
|
87 | 87 |
|
88 | 88 | - **Complete Image Resizing properties - [@GregBrimble], [pull/50]**
|
89 | 89 | Adds missing options for the Image Resizing API.
|
90 | 90 |
|
91 |
| - [@GregBrimble]: https://github.com/GregBrimble |
| 91 | + [@gregbrimble]: https://github.com/GregBrimble |
92 | 92 | [pull/50]: https://github.com/cloudflare/workers-types/pull/50
|
93 | 93 |
|
94 | 94 | - **Add API for async handlers and end handler - [@ObsidianMinor], [pull/48]**
|
95 | 95 | Types for [HTML Rewriter](https://developers.cloudflare.com/workers/runtime-apis/html-rewriter#end) end of document append method
|
96 | 96 |
|
97 |
| - [@ObsidianMinor]: https://github.com/ObsidianMinor |
| 97 | + [@obsidianminor]: https://github.com/ObsidianMinor |
98 | 98 | [pull/48]: https://github.com/cloudflare/workers-types/pull/48
|
99 | 99 |
|
100 | 100 | ### Bugfixes
|
|
153 | 153 | Remove this from your code:
|
154 | 154 |
|
155 | 155 | ```typescript
|
156 |
| - import {} from '@cloudflare/workers-types' |
| 156 | + import {} from "@cloudflare/workers-types"; |
157 | 157 | ```
|
158 | 158 |
|
159 | 159 | And instead include the types explicitly in your TypeScript configuration compiler options:
|
|
178 | 178 |
|
179 | 179 | ```typescript
|
180 | 180 | // Force response to be cached for 300 seconds.
|
181 |
| - fetch(event.request, { cf: { cacheTtl: 300 } }) |
| 181 | + fetch(event.request, { cf: { cacheTtl: 300 } }); |
182 | 182 |
|
183 | 183 | // Force response to be cached for 86400 seconds for 200 status codes, 1 second for 404, and do not cache 500 errors
|
184 |
| - fetch(request, { cf: { cacheTtlByStatus: { '200-299': 86400, '404': 1, '500-599': 0 } } }) |
| 184 | + fetch(request, { |
| 185 | + cf: { cacheTtlByStatus: { "200-299": 86400, "404": 1, "500-599": 0 } }, |
| 186 | + }); |
185 | 187 | ```
|
186 | 188 |
|
187 | 189 | Read more about these properties in the [`Request` docs](https://developers.cloudflare.com/workers/reference/apis/request/).
|
|
195 | 197 | The Workers runtime exposes a default global cache as `caches.default`, accessed like:
|
196 | 198 |
|
197 | 199 | ```typescript
|
198 |
| - let cache = caches.default |
| 200 | + let cache = caches.default; |
199 | 201 | ```
|
200 | 202 |
|
201 | 203 | This is an extension to the [Service Workers spec for `CacheStorage`](https://w3c.github.io/ServiceWorker/#cachestorage), and thus needed to be added explicitly to our type definitions.
|
|
238 | 240 | Previously, this pattern wasn't allowed:
|
239 | 241 |
|
240 | 242 | ```typescript
|
241 |
| - new Request(parsedUrl.toString(), request) |
| 243 | + new Request(parsedUrl.toString(), request); |
242 | 244 | ```
|
243 | 245 |
|
244 | 246 | This is because the `cf` object on inbound Request objects, and that expected in the `init` dictionary arg to the Request constructor, have a different shape.
|
|
247 | 249 |
|
248 | 250 | ```typescript
|
249 | 251 | interface RequestInit {
|
250 |
| - cf?: RequestInitCfProperties | IncomingRequestCfProperties |
| 252 | + cf?: RequestInitCfProperties | IncomingRequestCfProperties; |
251 | 253 | }
|
252 | 254 | ```
|
253 | 255 |
|
|
291 | 293 | Previously, the `KVNamespace` interface required that callers provide an empty options object when listing all the keys in a namespace, like so:
|
292 | 294 |
|
293 | 295 | ```typescript
|
294 |
| - await NAMESPACE.list({}) |
| 296 | + await NAMESPACE.list({}); |
295 | 297 | ```
|
296 | 298 |
|
297 | 299 | However, this argument is not actually required. This change updates the interface to match the runtime.
|
|
0 commit comments