rescript-lang.org
rescript-lang.org copied to clipboard
Document "@as(json`xxx`)"
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");
It gets a brief mention under fixed arguments: https://rescript-lang.org/docs/manual/latest/bind-to-js-function#fixed-arguments
#46 also describes this issue