Shortcut multiple @get and @send
Hello, I’m trying to create the following binding: const session = await stripe.checkout.sessions.create({ .... }); I have the stripe type can achieve this via: type checkout @get external checkout:...
View ArticleShortcut multiple @get and @send
Perhaps you could use something like this? @val @scope("stripe.checkout.sessions") external create : ({..}) => Promise.t<string> = "create"
View ArticleShortcut multiple @get and @send
Sorry, there is a bit more to it, it should be called on the stripe object: type stripe @module("stripe") @new external make: string => stripe = "default" @val @scope("checkout.sessions") external...
View ArticleShortcut multiple @get and @send
I see the issue. Maybe this will work? @send @scope(("checkout", "sessions")) external createCheckoutSession: (stripe, {..}) => Promise.t<string> = "create"
View ArticleShortcut multiple @get and @send
Yes, that works! ReScript Documentation ReScript Playground Try ReScript in the browser
View ArticleWhat would belong in a `.gitignore` template for ReScript?
I noticed GitHub - github/gitignore: A collection of useful .gitignore templates doesn’t have a template file for ReScript. I’m happy to send a PR for one, but first I want to get what should be...
View ArticleWhy do `.resi` and `.res` files require defining records twice (once in each...
Thanks for the answer! In the end I went with %%private since I was only trying to hide a single function from the file.
View ArticleWhy do `.resi` and `.res` files require defining records twice (once in each...
private by defaut and a “pub” keyword would be such an improvement
View ArticleCannot able create a Record from another Record (With all optional keys)
Apologies for missing your reply earlier. I’m creating a JSX using the generic JSX feature of ReScript. We have a native cross-platform renderer that requires a prop in string format. However, I don’t...
View ArticleCannot able create a Record from another Record (With all optional keys)
It’s not pretty, but the boilerplate can be written in rescript, via the object spread operator. Working off of the initial example: type a = { t ?: string, l ?: int, p ?: array<int> } type b =...
View ArticleCannot able create a Record from another Record (With all optional keys)
Alternatively, since there aren’t that many fields here, all of the pattern matching could be done at once. let mapper: (a) => b = (a) => switch a { | {t, l, p} => {t, l: "int", p: "array"} |...
View ArticleThis argument cannot be applied without label. Confused, can anyone explain?
Working with pipes can be tricky if you aren’t used to it, but once you grok it you will never want to go back. let fn = str => str ->String.trim ->String.toUpperCase
View ArticleWhat would belong in a `.gitignore` template for ReScript?
The output from create rescript app has this: .DS_Store /node_modules/ /lib/ .bsb.lock .merlin
View ArticleWhy do `.resi` and `.res` files require defining records twice (once in each...
I agree that a pub keyword would help make JS devs feel more at home.
View ArticleI made 3 new Rescript libraries! @jvlk/rescript-lite-jsx,...
These 3 packages work well together, but each can be used without the others. @jvlk/rescript-htmx - Very light bindings to use HTMX props with JSX. Planning on adding bindings for the JS client side...
View ArticleWhy do `.resi` and `.res` files require defining records twice (once in each...
Why pub and not just export ?
View ArticleCannot able create a Record from another Record (With all optional keys)
I have 250 fields in my prop type. For now, I did this let mapper: (a) => b = (a) => { ({ t ?: a.t , l ?: a.l->intToString , p ?: a.p->arrayToString } : b) } But in this also, If you...
View ArticleWhat would belong in a `.gitignore` template for ReScript?
.merlin is not needed anymore
View ArticleWhy do `.resi` and `.res` files require defining records twice (once in each...
pub feels more at home with the let binding, and exists in other ML family languages like Rust: Visibility and privacy - The Rust Reference export let foo = "bar" pub let foo = "bar" And we’re not...
View Article