Skip to content

Commit ef7828b

Browse files
committed
improve Bun shell example
1 parent c796a71 commit ef7828b

File tree

3 files changed

+21
-18
lines changed

3 files changed

+21
-18
lines changed

misc_docs/syntax/decorator_taggedTemplate.mdx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,19 @@ The `@taggedTemplate` decorator is used to bind to JavaScript tag functions.
1414
<CodeTab labels={["ReScript", "JS Output"]}>
1515

1616
```res example
17-
type res
18-
@module("bun") @taggedTemplate
19-
external sh: (array<string>, array<string>) => promise<res> = "$"
17+
// see https://bun.sh/docs/runtime/shell
18+
type result = {exitCode: int}
19+
@module("bun") @taggedTemplate
20+
external sh: (array<string>, array<string>) => promise<result> = "$"
2021
2122
let filename = "index.res"
22-
let res = await sh`ls ${filename}`
23+
let result = await sh`ls ${filename}`
2324
```
2425

2526
```js
2627
import * as $$Bun from "bun";
27-
var filename = "index.res"
28-
var res = await $$Bun.$`ls ${filename}`
28+
var filename = "index.res";
29+
var result = await $$Bun.$`ls ${filename}`;
2930
```
3031

3132
</CodeTab>

pages/docs/manual/latest/bind-to-js-function.mdx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -435,18 +435,19 @@ You add the `@taggedTemplate` annotation and you're good to go!
435435
<CodeTab labels={["ReScript", "JS Output"]}>
436436

437437
```res example
438-
type res
439-
@module("bun") @taggedTemplate
440-
external sh: (array<string>, array<string>) => promise<res> = "$"
438+
// see https://bun.sh/docs/runtime/shell
439+
type result = {exitCode: int}
440+
@module("bun") @taggedTemplate
441+
external sh: (array<string>, array<string>) => promise<result> = "$"
441442
442443
let filename = "index.res"
443-
let res = await sh`ls ${filename}`
444+
let result = await sh`ls ${filename}`
444445
```
445446

446447
```js
447448
import * as $$Bun from "bun";
448-
var filename = "index.res"
449-
var res = await $$Bun.$`ls ${filename}`
449+
var filename = "index.res";
450+
var result = await $$Bun.$`ls ${filename}`;
450451
```
451452

452453
</CodeTab>

pages/docs/manual/latest/interop-cheatsheet.mdx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -199,18 +199,19 @@ external join: array<string> => string = "join"
199199
<CodeTab labels={["ReScript", "JS Output"]}>
200200

201201
```res example
202-
type res
203-
@module("bun") @taggedTemplate
204-
external sh: (array<string>, array<string>) => promise<res> = "$"
202+
// see https://bun.sh/docs/runtime/shell
203+
type result = {exitCode: int}
204+
@module("bun") @taggedTemplate
205+
external sh: (array<string>, array<string>) => promise<result> = "$"
205206
206207
let filename = "index.res"
207-
let res = await sh`ls ${filename}`
208+
let result = await sh`ls ${filename}`
208209
```
209210

210211
```js
211212
import * as $$Bun from "bun";
212-
var filename = "index.res"
213-
var res = await $$Bun.$`ls ${filename}`
213+
var filename = "index.res";
214+
var result = await $$Bun.$`ls ${filename}`;
214215
```
215216

216217
</CodeTab>

0 commit comments

Comments
 (0)