Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#### :rocket: New Feature

- Add `RegExp.flags`. https://github.com/rescript-lang/rescript/pull/7461
- Add `options` argument to `Console.dir`. https://github.com/rescript-lang/rescript/pull/7504

#### :bug: Bug fix

Expand Down
7 changes: 6 additions & 1 deletion runtime/Stdlib_Console.res
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,12 @@
@val external debug6: ('a, 'b, 'c, 'd, 'e, 'f) => unit = "console.debug"
@val @variadic external debugMany: array<_> => unit = "console.debug"

@val external dir: 'a => unit = "console.dir"
type dirOptions = {
colors?: bool,
depth?: Stdlib_Nullable.t<int>,
showHidden?: bool,
}
@val external dir: ('a, ~options: dirOptions=?) => unit = "console.dir"
@val external dirxml: 'a => unit = "console.dirxml"

@val external error: 'a => unit = "console.error"
Expand Down
10 changes: 8 additions & 2 deletions runtime/Stdlib_Console.resi
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,13 @@ Console.debugMany([1, 2, 3])
@variadic
external debugMany: array<_> => unit = "console.debug"

type dirOptions = {
colors?: bool,
depth?: Stdlib_Nullable.t<int>,
showHidden?: bool,
}
/**
`dir(object)` displays an interactive view of the object in the console.
`dir(object, options)` displays an interactive view of the object in the console.
See [`console.dir`](https://developer.mozilla.org/en-US/docs/Web/API/console/dir)
on MDN.
Expand All @@ -254,10 +259,11 @@ on MDN.
```rescript
Console.dir({"language": "rescript", "version": "10.1.2"})
Console.dir({"language": "rescript", "version": {"major": "10", "minor": "1", "patch": "2"}}, ~options={depth: null})
```
*/
@val
external dir: 'a => unit = "console.dir"
external dir: ('a, ~options: dirOptions=?) => unit = "console.dir"

/**
`dirxml(object)` displays an interactive tree view of an XML/HTML element in the console.
Expand Down
Loading