Skip to content

@ocaml.doc -> proper doc comments #141

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 4, 2025
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 2 additions & 2 deletions src/RescriptReactErrorBoundary.res
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
@ocaml.doc("
/***
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is three * to document the module?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it's at the module level, not attached to a function or type def. So it's like a value with no runtime.

* Important note on this module:
* As soon as React provides a mechanism for error-catching using functional component,
* this is likely to be deprecated and/or move to user space.
")
*/
type info = {componentStack: string}

type params<'error> = {
Expand Down
4 changes: 2 additions & 2 deletions src/RescriptReactErrorBoundary.resi
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
@ocaml.doc("
/***
* Important note on this module:
* As soon as React provides a mechanism for error-catching using functional component,
* this is likely to be deprecated and/or move to user space.
")
*/
type info = {componentStack: string}

type params<'error> = {
Expand Down
22 changes: 8 additions & 14 deletions src/RescriptReactRouter.resi
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
@ocaml.doc(
"update the url with the string path. Example: `push(\"/book/1\")`, `push(\"/books#title\")` "
)
/** update the url with the string path. Example: `push(\"/book/1\")`, `push(\"/books#title\")` */
let push: string => unit

@ocaml.doc(
"update the url with the string path. modifies the current history entry instead of creating a new one. Example: `replace(\"/book/1\")`, `replace(\"/books#title\")` "
)
/** update the url with the string path. modifies the current history entry instead of creating a new one. Example: `replace(\"/book/1\")`, `replace(\"/books#title\")` */
let replace: string => unit
type watcherID
type url = {
Expand All @@ -17,15 +13,13 @@ type url = {
search: string,
}

@ocaml.doc(
"start watching for URL changes. Returns a subscription token. Upon url change, calls the callback and passes it the url record "
)
/** start watching for URL changes. Returns a subscription token. Upon url change, calls the callback and passes it the url record */
let watchUrl: (url => unit) => watcherID

@ocaml.doc(" stop watching for URL changes ")
/** stop watching for URL changes */
let unwatchUrl: watcherID => unit

@ocaml.doc("this is marked as \"dangerous\" because you technically shouldn't
/** this is marked as \"dangerous\" because you technically shouldn't
be accessing the URL outside of watchUrl's callback; you'd read a potentially
stale url, instead of the fresh one inside watchUrl.

Expand All @@ -37,10 +31,10 @@ let unwatchUrl: watcherID => unit
So, the correct (and idiomatic) usage of this helper is to only use it in
a component that's also subscribed to watchUrl. Please see
https://github.com/reasonml-community/reason-react-example/blob/master/src/todomvc/TodoItem.re
for an example.")
for an example. */
let dangerouslyGetInitialUrl: (~serverUrlString: string=?, unit) => url

@ocaml.doc("hook for watching url changes.
/** hook for watching url changes.
* serverUrl is used for ssr. it allows you to specify the url without relying on browser apis existing/working as expected
")
*/
let useUrl: (~serverUrl: url=?, unit) => url