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

Error compiling @rescript/core with Rescript 11

Ok, so if I understood correctly, the way to go is to adopt uncurried if I want to use @rescript/core

View Article


How can i make sure dotenv is loaded

You mean the Dotenv.config() call? It shouldn’t be above requires (not before require("dotenv") at least), or you’ll end up trying to access a property of Dotenv before it’s assigned.

View Article


Model string value from external system

Hello, I would like to model the a record field contactPerson of type string. It can be absent from the record, so one would think to use option<string>, however, if the value is absent it will...

View Article

Model string value from external system

If you explicitly need it to be null or a string and not undefined, you can use Null.t which is defined as @unboxed type t<'a> = | Value('a) | @as(null) Null (as opposed to Nullable.t which is...

View Article

Model string value from external system

Alternatively, you can use rescript-schema to leverage data transformation when interacting with external systems: type info = { contractPerson: option<string>, } let infoSchema = S.object(s...

View Article


Image may be NSFW.
Clik here to view.

Model string value from external system

Off topic because I don’t think non-empty string was what you were after literally, but with v11 and unboxed variants, you can easily model a non empty string in the type system: @unboxed type str = |...

View Article

Notes about migrating from bs-platform 8.2 to rescript 11

Hello folks, I recently upgraded the re-ansi library from reason to latest rescript, and here a few notes about this migration. First, the new tooling and syntax was straightforward to adopt. Beside...

View Article

Rescript: How to model package.json / 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")...

View Article


Tailwind CSS: adding `className` to components

Hi there ! I’m trying to use tailwind CSS with React Native. What is the best way to wrap components. Unfortunately, I cannot find a simple way to extend types with “className”… Maybe this could be...

View Article


Rescript: How to model package.json / collection of two strings

In ReScript, Array access returns an option by default instead of giving you a runtime error when the Array is empty. let deps = switch result.scripts[0] { | Some(packageData) => packageData.name |...

View Article

Image may be NSFW.
Clik here to view.

Rescript: How to model package.json / collection of two strings

There are a few things going on here. The first thing is that you defined multiple records that share the same fields (in this case, the field name), so the compiler thinks you’re referring to the...

View Article

Tailwind CSS: adding `className` to components

Indeed in this case the best solution is likely to spread the jsx type and add a styled field to it, you can read more about customizing JSX here.

View Article

Tailwind CSS: adding `className` to components

Unfortunately, this doesn’t work because the types for a component can be defined as named function arguments instead of an object: type styledProps<'a> = { ...'a, // <=== The type 'a is not...

View Article


Tailwind CSS: adding `className` to components

So, I explored changing the types in rescript-react-native to a record (named _props to not conflict with the props type created by @react.component). Now this seems to work. Are there any downsides...

View Article

Image may be NSFW.
Clik here to view.

[Article] ReScript has come a long way, maybe it's time to switch from...

Made it into the top 7 featured posts of the week! DEV Community Top 7 Featured DEV Posts of the Week Welcome to this week's Top 7, where the DEV Team handpicks our favorite posts from the previous...

View Article


[ANN] ReScript Retreat Roadmap Summary 2024

I wonder what are the pain points for implementing preserve mode ?

View Article

RegExp.Result.t inconsistency

Recently I’ve been playing around with regex to consume some info from query parameters and noticed what I think is an inconsistency between what js can return and what ReScript types results as....

View Article


RegExp.Result.t inconsistency

I was just going to open an issue in the rescript-core repo for this. As a workaround you can use Js.String2.match_, which is typed to return an option<array<option<string>>>

View Article

Image may be NSFW.
Clik here to view.

Tailwindcss fold classes in Rescript/React

What do you guys use to fold the classes inside react elements. It can become noisy when using TailwindCSS. There are some VSCode extensions like Tailwind Fold They fold the classnames but I haven’t...

View Article

Tailwindcss fold classes in Rescript/React

tbh I’ve been using tailwind since before 1.x and its never bothered me. last place I worked at we used a tool, rustywind, to sort/format/deduplicate our tailwind classes. it was an Elm app, so a...

View Article
Browsing all 2602 articles
Browse latest View live