Is there any reason why functions which can return null in JS (e.g. document.querySelector) are not typed as returning option values? With the current types it's trivial to get runtime errors which I wouldn't expect from a statically typed language that compiles to JS. In TypeScript that function returns Element | null which means the user cannot call methods on it without checking that it's not null. In OCaml (BuckleScript) it returns Dom.element option. I would expect the same in F#.
cc @nojaf who suggested I open an issue here
Is there any reason why functions which can return
nullin JS (e.g.document.querySelector) are not typed as returningoptionvalues? With the current types it's trivial to get runtime errors which I wouldn't expect from a statically typed language that compiles to JS. In TypeScript that function returnsElement | nullwhich means the user cannot call methods on it without checking that it's notnull. In OCaml (BuckleScript) it returnsDom.element option. I would expect the same in F#.cc @nojaf who suggested I open an issue here