// compiles successfully
type a = {
href?: string
}
Creating an empty record “out of it” is of course not possible:
let x = {}
// or the suggestive annotation
let x : a = {}
// raises
// Error: This let-binding misses an expression
Is it correct to conclude that the experimental optional record fields introduced in v10 (ReScript 10.0 | ReScript Blog) cannot create objects with all optional fields?
I wonder what the semantics of specifying an empty record are.
I just installed rescript@next, but after restarting the LSP (and VS Code), the following snippet still gives an error:
type attrs = {class?: string}
@module("@hyperapp/html") @val external aside: (attrs, array<vnode>) => vnode = "aside"
open Hyperapp.Html
let _ = aside({}, [text("Contact info"])
~
// Error (squiggly red under the closing brace of the empty {}): Missing expression
P.S.:This feature still raises the above mentioned error under the extension v1.6.0. I upgraded to the pre-release version and now the error is gone. So until rescript v10.1 stable lands, rescript@latest along with rescript-vscode pre-release should do the job.