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

How do you writing bindings today?

I would say: use the form you prefer. I would write my bindings in the second form (SomeLib.instance->SomeLib.exec()), so it is more idiomatic (compare rescript/core, std lib, etc.)

View Article


@obj deprecated how to deal with variadic polymorphic values

Hello there, I’m currently writing some bindings for the latest version of @tanstack/react-table and noticed that @obj decorator is deprecated. This decorator is pretty useful for this library because...

View Article


How do you writing bindings today?

For the specific case I’d write it this way: module SomeLib = { @module("xx") @scope("default") external exec: unit => int = "exec" } SomeLib.exec()

View Article

Image may be NSFW.
Clik here to view.

How do you writing bindings today?

DCKT: But today we can write JS like bindings like this : type lib = { exec: unit => int } @module("xx") external myLib: lib = "default" myLib.exec() I don’t recommend the options, because when...

View Article

@obj deprecated how to deal with variadic polymorphic values

(post deleted by author)

View Article


Type duplication between interface file and implementation

Hi, New to rescript and first post. What do we think about type duplication between .resi interface files and implementation, I can see that becoming hard to maintain. Did I miss a way of doing that?...

View Article

How to write a typescript union-like

Is this the right way to write a type that can only take 2 strings? Like a typescript union. type EitherOne = "one" | "two"; const thatOne: EitherOne = "one"; I’m asking because, I didn’t find this...

View Article

Missing type annotation from generated interface file

Not sure this is a bug or not but when I generated an interface file using the vscode extension, it converted this type: type tokenType = | @as("bearer") Bearer To this type: type tokenType = Bearer...

View Article


Printing PPX'd source with ReScript

Before v11, I used reason + refmt to print generated code to debug PPXs. Since Reason support is dropped, is there a way to debug generated code somehow?

View Article


Quick migration guide to uncurried mode for PPX maintainers?

Is there a summary of AST changes and what needs to be done to migrate old PPXs to the v11?

View Article

How to write a typescript union-like

Yes. But string-unions are something that you typically only find in ReScript codebases when dealing with TypeScript libraries. As long as you can stay inside ReScript-Land you would just use type...

View Article

Image may be NSFW.
Clik here to view.

What's the current view on PPX usage?

Hi all! Some years ago, using and writing PPXs for ReScript was discouraged by the core team, and that was enforced very strongly, in my opinion. But since then, ReScript has changed to be more...

View Article

[ANN] `@rescript/language-server` and `@rescript/tools` released

Zed support would be amazing!

View Article


Quick migration guide to uncurried mode for PPX maintainers?

There’s no proper write up AFAIK but here are a few resources: ppx_spice migrates to support v11: Support uncurried on v11 by mununki · Pull Request #49 · green-labs/ppx_spice · GitHub rescript-relay...

View Article

Missing type annotation from generated interface file

This is a bug in the editor tooling, could you file an issue on that repo?

View Article


How do you writing bindings today?

Yes for this case, I tend to use this kind of declaration. But as the goal is to be as close as possible to JavaScript, I think the second option can be relevant (when the API allows it)

View Article

@obj deprecated how to deal with variadic polymorphic values

I guess you could do something like this: @unboxed type rec column<'tableData> = | Column({ id: string, accessorFn: 'tableData => 'columnData, header?: unit => React.element, footer?: unit...

View Article


Type duplication between interface file and implementation

In my opinion it’s an issue that should be solved by a better IDE support, but if you’re looking for a solution nevertheless, there’s an easy way, define the types of your file A.res in a third file...

View Article

How do I correctly configure my own JSX module?

Hi, so I have my rescript json like so: { "name": "review_app", "sources": [ { "dir": "src", "subdirs": true } ], "package-specs": [ { "module": "es6", "in-source": true } ], "suffix": ".res.mjs",...

View Article

How do I correctly configure my own JSX module?

You need to use version 11.1.0-rc.2, then it should work. It looks like you need to restructure your JSX module a bit too. Check out the docs: JSX | ReScript Language Manual

View Article
Browsing all 2165 articles
Browse latest View live