How do I import Json?
How do I add with { type: "json" } in import json from "./data.json" with { type: "json" };?
View ArticleAwait top level promise
Hello, For a Node/Bun script I need to await the top level promise: let yow = async () => { Console.log("doing promise stuff") } yow()->Promise.done compiles to async function yow() {...
View ArticleAwait top level promise
You can just write await at the top level and it’ll work fine in Bun at least.
View ArticleAwait top level promise
Oh, ok, this only works when your promise returns unit. Mine was returning an array of unit. Thanks!
View ArticleHow do I import Json?
nojaf: on from "./data.json" with { type: "json" };? @module({from: "./data.json", with: {type_: "json"}}) external json: JSON.t = "default" Compiles to: import DataJson from "./data.json" with...
View ArticleHow do I import Json?
Thanks, I missed Import from / Export to JS | ReScript Language Manual indeed.
View ArticleAwait top level promise
Oh TIL! Didn’t know this was possible, had a similar situation recently
View ArticleAwait top level promise
nojaf: Oh, ok, this only works when your promise returns unit. If you need to await a function that returns something, it’s common to assign it to _ to discard the return value let _ = await...
View ArticleCurrent goal of genType with regard to type safety
I’m not sure to follow, what are you trying to do? Gentype is meant to be type safe from rescript to typescript, and the goal is to make it runtime free.
View Article11.1 type confusion?
Hi All. Im trying to bring rescript-parser to latest and seeing this error: This has type: t<('a, 'b) => 'c> But this function argument is expecting: t<('a, 'b) => 'c> These two...
View Article11.1 type confusion?
Hmm, this usually means that the expected and actual type have different curried uncurried statuses. This can happen when you use functions from the JS or Belt modules that expect curried functions....
View Article[ANN] rescript-rest - RPC-like client, contract, and server implementation...
ReScript Rest v0.7.0 is out with the Fastify integration.
View ArticleFormData and Object bindings
Hi, I’m have a meta question about bindings. I’m getting the hang of creating them but when I write something like: module FormData = { type t @new external make: 'form => t = "FormData" @send...
View ArticleFormData and Object bindings
Object.fromEntries is bound by both Dict.fromArray and Dict.fromIterator. About FormData, there is a fairly recent thread: Using FormData in rescript react, but I agree it should be easier to find and...
View ArticleNameof operator
Some time later, I’m not super excited anymore about this solution. My nameof operator, it always needs a type annotation like nameof((o: Domain.Firebase.order) => o.isProcessed) and I don’t find...
View ArticleNeed help in using ApexCharts from rescript
Hi i am facing an issue with open ApexCharts it throws an error `The module or file ApexCharts can’t be found. If it’s a third-party dependency: Did you list it in bsconfig.json? Did you run rescript...
View ArticlegenType for core library
Hey, I was trying to add @genTypes in my project and I’m encountering this issue in my project. So it’s trying to look for the *.gen.tsx file for the core libraries types. Attaching screenshot for the...
View ArticlegenType for core library
{ "$schema": "https://raw.githubusercontent.com/rescript-lang/rescript-compiler/master/docs/docson/build-schema.json", "name": "----------", "jsx": { "version": 4, "mode": "classic" }, "bsc-flags":...
View ArticleCurrent goal of genType with regard to type safety
Thanks for the reply! Gentype is meant to be type safe from rescript to typescript This is a change, whether intentionally or not, from what used to be to contract that genType provided (whether...
View ArticleCurrent goal of genType with regard to type safety
And it turns out I was right, this was an unintended (or unforeseen at least) change.
View Article