rescript-lang.org icon indicating copy to clipboard operation
rescript-lang.org copied to clipboard

Document "@as(json`xxx`)"

Open cristianoc opened this issue 1 year ago • 2 comments

Looks like this is missing in the documentation.


@module("library-x") @val
external doStuff: (@as(json`{format:"utf8", includeStuff: false}`) _, string) => string = "doStuff"


let fileContents = doStuff("somefilename.txt")
// Compiles to:
// var fileContents = LibraryX.doStuff({format:"utf8", includeStuff: false}, "somefilename.txt");

cristianoc avatar Sep 07 '22 09:09 cristianoc

It gets a brief mention under fixed arguments: https://rescript-lang.org/docs/manual/latest/bind-to-js-function#fixed-arguments

nireno avatar Sep 08 '22 19:09 nireno

#46 also describes this issue

nireno avatar Sep 08 '22 20:09 nireno