Quantcast
Channel: ReScript Forum - Latest posts
Browsing all 2168 articles
Browse latest View live

Making a module optional in a parent module signature

I would like to pass a module Library with react components to a module Menu for instance. If the Library has a PageSubtitle component it will use it if not it will use its own. But I guess I could...

View Article


Making a module optional in a parent module signature

You could also use first class modules and make the pageTitle parameter optional.

View Article


Making a module optional in a parent module signature

Thank you @tsnobip That could be a solution. I’m not sure how it would keep the code more simple. For now this is what I’m thinking of doing but I would very much welcome any other ideas. I would like...

View Article

Image may be NSFW.
Clik here to view.

Senior Frontend Engineer at Carla

Hi , We are looking for a talented and motivated senior frontend engineer to join our team! We have about 130k lines of Rescript code powering our tools and apps for our internal users, and about 60k...

View Article

Naming conflicts between models and components

In my projects, I typically make a data module, for my Entities or end points. These are the ones that follow the type t convention along with utils for fetching data. Using a blog just as an example,...

View Article


Naming conflicts between models and components

There are two conventional approaches I’ve seen in the wild and personally adopted Preface the file name with the directory name // Models__Comment.res type t = { author: string, content: string } let...

View Article

Making a module optional in a parent module signature

To be honest, I think your solution is the simplest. What’s the problem with this extra line?

View Article

Making a module optional in a parent module signature

Thank you @tsnobip The problem is that a real life case would include at least 30 components and I would need to add many extra boilerplate lines.

View Article


Making a module optional in a parent module signature

It depends how often you want to customize the optional fields, if most of the times you want the default, then using first class modules is likely easier. I don’t have access to my computer until...

View Article


Making a module optional in a parent module signature

I think I would always be passing a few customised values to the optional fields, but hardly ever all of them. I am curious to see an example using first class modules. I’m not very familiar with...

View Article

Image may be NSFW.
Clik here to view.

Syntax for unwrapping Option inside function

I find ReScript to be quite interesting language, however AFAIK it doesn’t support any dedicated syntax for unwrapping Option type. We have to compare Option in the switch statement, or do some kind...

View Article

Can't access module from test file

So if I have src/Demo.res and test/Demo.test.res everything is fine if I don’t need to access Demo.res. But if I need to access a function in Demo.res in the test, Demo.test.res won’t compile and I...

View Article

Syntax for unwrapping Option inside function

There has been both discussions about automatic optional chaining and if let and it’s something we want in some form, but still not sure how.

View Article


Image may be NSFW.
Clik here to view.

Can't access module from test file

I remember I was trying to fix the issue a while ago, but I wasn’t familiar with the compiler good enough back then, so I failed. I want to try again at some point. I personally worked around the...

View Article

Image may be NSFW.
Clik here to view.

[RFC] Automatic optional chaining

I started new topic, but I guess I can say few words here. Note that majority of my experience comes from backend development, so I might have a bit different view from others. Syntax for unwrapping...

View Article


Can't access module from test file

Changing to _test definitely works. Initially I thought it wouldn’t work with Bun Test runner, but turns out there must be a typo in their error message that said the file name had to have “test” in...

View Article

Image may be NSFW.
Clik here to view.

Making a module optional in a parent module signature

Here is a demo with a first class modules. Indeed we should document it. ReScript Documentation ReScript Playground Try ReScript in the browser

View Article


Image may be NSFW.
Clik here to view.

Making a module optional in a parent module signature

And here is a demo using a record, it’s likely the most cumbersome of all the variants. To be honest I’d still use your solution, it’s simpler and more explicit, this way you won’t forget to define...

View Article

Making a module optional in a parent module signature

Thank you @tsnobip. I think the first example is the best option of all. I wasn’t sure how to turn a function parameter (the value of which is a module/react component) back to a module/react...

View Article

What would belong in a `.gitignore` template for ReScript?

And now this has been merged!

View Article
Browsing all 2168 articles
Browse latest View live