You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/content/docs/ai-gateway/integrations/worker-binding-methods.mdx
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -25,6 +25,8 @@ binding = "AI"
25
25
26
26
This configuration sets up the AI binding accessible in your Worker code as `env.AI`.
27
27
28
+
<Renderfile="wrangler-typegen" />
29
+
28
30
## 2. Basic Usage with Workers AI + Gateway
29
31
30
32
To perform an inference task using Workers AI and an AI Gateway, you can use the following code:
@@ -78,7 +80,7 @@ gateway.patchLog("my-log-id", {
78
80
79
81
### 3.2. `getLog`: Read Log Details
80
82
81
-
The `getLog` method retrieves details of a specific log ID. It returns an object of type `Promise<AiGatewayLog>`. If this type is missing, ensure you have run [`wrangler types`](/workers/languages/typescript/#generate-types)
83
+
The `getLog` method retrieves details of a specific log ID. It returns an object of type `Promise<AiGatewayLog>`. If this type is missing, ensure you have run [`wrangler types`](/workers/languages/typescript/#generate-types).
Copy file name to clipboardExpand all lines: src/content/docs/browser-rendering/platform/playwright.mdx
+2-15Lines changed: 2 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -42,6 +42,8 @@ binding = "MYBROWSER"
42
42
43
43
</WranglerConfig>
44
44
45
+
<Renderfile="wrangler-typegen" />
46
+
45
47
Install the npm package:
46
48
47
49
```bash
@@ -55,13 +57,8 @@ Let's look at some examples of how to use Playwright:
55
57
Using browser automation to take screenshots of web pages is a common use case. This script tells the browser to navigate to https://demo.playwright.dev/todomvc, create some items, take a screenshot of the page, and return the image in the response.
One of the most common use cases for using Playwright is software testing. Playwright includes test assertion features in its APIs; refer to [Assertions](https://playwright.dev/docs/test-assertions) in the Playwright documentation for details. Here's an example of a Worker doing `expect()` test assertions of the [todomvc](https://demo.playwright.dev/todomvc) demo page:
Copy file name to clipboardExpand all lines: src/content/docs/d1/worker-api/index.mdx
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,7 +18,7 @@ Refer to the relevant sections for the API documentation.
18
18
19
19
## TypeScript support
20
20
21
-
D1 Worker Bindings API is fully-typed via the types generated by running [`wrangler types`](/workers/languages/typescript/#typescript) package, and also supports [generic types](https://www.typescriptlang.org/docs/handbook/2/generics.html#generic-types) as part of its TypeScript API. A generic type allows you to provide an optional `type parameter` so that a function understands the type of the data it is handling.
21
+
D1 Worker Bindings API is fully-typed via the runtime types generated by running [`wrangler types`](/workers/languages/typescript/#typescript) package, and also supports [generic types](https://www.typescriptlang.org/docs/handbook/2/generics.html#generic-types) as part of its TypeScript API. A generic type allows you to provide an optional `type parameter` so that a function understands the type of the data it is handling.
22
22
23
23
When using the query statement methods [`D1PreparedStatement::run`](/d1/worker-api/prepared-statements/#run), [`D1PreparedStatement::raw`](/d1/worker-api/prepared-statements/#raw) and [`D1PreparedStatement::first`](/d1/worker-api/prepared-statements/#first), you can provide a type representing each database row. D1's API will [return the result object](/d1/worker-api/return-object/#d1result) with the correct type.
Copy file name to clipboardExpand all lines: src/content/docs/vectorize/reference/client-api.mdx
+1-3Lines changed: 1 addition & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -218,6 +218,4 @@ Refer to the [bindings documentation](/workers/wrangler/configuration/#vectorize
218
218
219
219
## TypeScript Types
220
220
221
-
New Workers projects created via `npm create cloudflare@latest` automatically include the relevant TypeScript types for Vectorize.
222
-
223
-
If you have an older project, or a non-Workers projects looking to use Vectorize's [REST API](https://developers.cloudflare.com/api/resources/vectorize/subresources/indexes/methods/list/) in a TypeScript project, you should ensure you have a compatibility date later than `2023-09-22` and that you have generated types by running [`wrangler types`](/workers/languages/typescript/#generate-types).
Ensure you have a compatibility date `2024-10-22` or later installed when binding to Workflows from within a Workers project. If you are using TypeScript, ensure you have generated types by running [`wrangler types`](/workers/languages/typescript/#generate-types).
221
+
Ensure you have a compatibility date `2024-10-22` or later installed when binding to Workflows from within a Workers project.
220
222
221
223
:::
222
224
223
225
The `Workflow` type provides methods that allow you to create, inspect the status, and manage running Workflow instances from within a Worker script.
224
226
225
-
```ts
227
+
```ts title="./worker-configuration.d.ts"
226
228
interfaceEnv {
227
229
// The 'MY_WORKFLOW' variable should match the "binding" value set in the Wrangler config file
If you're using TypeScript, run [`wrangler types`](/workers/wrangler/commands/#types) whenever you modify your Wrangler configuration file. This generates types for the `env` object based on your bindings, as well as [runtime types](/workers/languages/typescript/).
0 commit comments