83 questions
3
votes
0
answers
62
views
How to import TypeScript types and values in ReScript?
https://rescript-lang.org/docs/manual/v11.0.0/typescript-integration says
The ReScript compiler includes a code generation tool that lets you export ReScript values and types to use in TypeScript, ...
0
votes
2
answers
95
views
ReScript test setup: Trouble opening src module
I'm new to ReScript (previously BuckleScript) and trying to create a basic project template. I'm having trouble setting up unit testing. Here is my current setup:
Folder stucture
src/Demo.res
test/...
1
vote
1
answer
51
views
How to model collection of two strings
Forgive the primitiveness of my question. I'm exploring Rescript and I'd like to open my package.json file into a typed datastore.
I've made some progress, but I need some direction:
@module("fs&...
0
votes
1
answer
113
views
How do I use the modulus operator?
When using the % operator I am left with the error "Did you forget a , here?". Is there another keyword for % in ReScript?
Js.log(20 % 2)
Note: This is a translation of this question for ...
0
votes
1
answer
57
views
What is the difference between option<t>=? and just =? in ReScript JSX?
From the documentation of ReScript React, I can declare a component like this:
module OptionalChildren = {
@react.component
let make = (~children: option<React.element>=?, ~children2: React....
0
votes
1
answer
130
views
How to do Try-Finally in ReScript?
According to ReScript's documentation, try-catch blocks cannot have a finally clause.
My question is twofold:
Firstly, what on Earth possessed them? What was the motivation? How does removing this ...
0
votes
1
answer
176
views
Getting data from Rescript input fields
I have this code for two input fields and a button: I have this code at the end:
<Form onFinish={onSubmit2URLs}>
<Form.Item name="url1" label="URL 1"> <Input /> &...
0
votes
1
answer
168
views
Getting FormData with rescript
I have a Rescript react component which contains a form. I am trying to get the FormData when the form is submitted, but I am a bit confused about how to do that.
My component:
@react.component
let ...
0
votes
1
answer
254
views
CSS won't load when using CSS modules
I am trying to write a simple react component in rescript and have a CSS file for the component. I am trying to do this with Webpack.
Here is my entire project code
Webpack.config.js
const path = ...
0
votes
0
answers
119
views
Creating a vs code extension using Rescript
I am new to using rescript and trying to convert an extension I started writing in typescript into rescript. I cannot figure out how to access the vs code extension api though.
Is there a way to ...
0
votes
1
answer
234
views
How to do ReactDOM.createRoot?
I wrote this code
switch (ReactDOM.querySelector("#myapp")) {
| Some(myapp) => ReactDOM.createRoot(myapp).render(<MyComponent />)
| None => Js.log("we could not find myapp ...
0
votes
2
answers
191
views
Convert Json array to list of strings
I am reading this tutorial https://www.stackbuilders.com/blog/nonsense-getting-started-with-reason-and-reason-react/. One of the problems I am facing is that api.noopschallenge.com is now dead. I ...
0
votes
1
answer
44
views
pass type to module for abstract data type
I am trying to create a heap module (and eventually priority queue) implemented with an array.
The portion of the heap I have written so far compiles fine:
module MinHeap = {
type elem
type heap = ...
0
votes
1
answer
396
views
Rescript manipulate JSON file
I have this JSON file.
Using rescript I want to :
Read the file.
Extract data from the file.
Write result in a new file.
{
"name": "name",
"examples": [...
0
votes
1
answer
48
views
Is a simple way to use `Belt.Set` (and others) fixing its type?
I'm creating a functor for opaque identifiers to allow the type system help catching issues where you're supposed to have an identifier of A, but you're being given an identifier of B.
I've already ...