Skip to content

Commit 062ce41

Browse files
committed
Fix TypeScriptExample
1 parent a56ae14 commit 062ce41

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

src/content/partials/workers/service-binding-rpc-example.mdx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ main = "./src/workerB.js"
1717

1818
<TypeScriptExample>
1919

20-
```js
20+
```ts
2121
import { WorkerEntrypoint } from "cloudflare:workers";
2222

2323
export default class extends WorkerEntrypoint {
@@ -49,11 +49,15 @@ services = [
4949

5050
Making it possible for Worker A to call the `add()` method from Worker B:
5151

52-
```js
52+
<TypeScriptExample>
53+
54+
```ts
5355
export default {
5456
async fetch(request, env) {
5557
const result = await env.WORKER_B.add(1, 2);
5658
return new Response(result);
5759
},
5860
};
5961
```
62+
63+
</TypeScriptExample>

src/content/partials/workers/service-binding-rpc-functions-example.mdx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ main = "./src/counterService.js"
1717

1818
<TypeScriptExample>
1919

20-
```js
20+
```ts
2121
import { WorkerEntrypoint } from "cloudflare:workers";
2222

2323
export default class extends WorkerEntrypoint {
@@ -35,6 +35,8 @@ export default class extends WorkerEntrypoint {
3535
}
3636
```
3737

38+
</TypeScriptExample>
39+
3840
This function can then be called by the client Worker:
3941

4042
<WranglerConfig>
@@ -49,6 +51,8 @@ services = [
4951

5052
</WranglerConfig>
5153

54+
<TypeScriptExample>
55+
5256
```ts
5357
export default {
5458
async fetch(request: Request, env: Env) {

0 commit comments

Comments
 (0)