Open
Conversation
nojaf
commented
Jan 19, 2026
| @@ -0,0 +1,57 @@ | |||
| // Generated by ReScript, PLEASE EDIT WITH CARE | |||
|
|
|||
| import * as Primitive_option from "@rescript/runtime/lib/es6/Primitive_option.js"; | |||
Member
Author
There was a problem hiding this comment.
This is why I added @rescript/runtime to the dependencies.
I think it is correct to do so.
Member
There was a problem hiding this comment.
Would making @rescript/runtime a peer dependency work?
Member
Author
There was a problem hiding this comment.
I'm not sure, the reason I want to be explicit with "@rescript/runtime" is that I see this popping up in isolated installs.
| "sources": [{ "dir": "src", "subdirs": true }], | ||
| "package-specs": [{ "module": "commonjs", "in-source": true }], | ||
| "suffix": ".bs.js", | ||
| "bs-dev-dependencies": [], |
| let safeMakeEvent = eventName => | ||
| if Js.typeof(event) == "function" { | ||
| if typeof(event) == #function { | ||
| makeEventIE11Compatible(eventName) |
Member
Author
There was a problem hiding this comment.
I hope we no longer care about IE11?
Member
|
I would also make @rescript/runtime a peer dependency. |
tsnobip
reviewed
Jan 20, 2026
Comment on lines
44
to
66
| @@ -52,16 +52,16 @@ module FormData = { | |||
|
|
|||
| let getFile = (formData, name) => { | |||
| switch formData->getUnsafe(name) { | |||
| | Some(value) => Js.typeof(value) === "string" ? None : Some(value->_asFile) | |||
| | Some(value) => typeof(value) === #string ? None : Some(value->_asFile) | |||
| | _ => None | |||
| } | |||
| } | |||
|
|
|||
| let getAll = (t, string) => { | |||
| t | |||
| ->getAllUnsafe(string) | |||
| ->Js.Array2.map(value => { | |||
| Js.typeof(value) === "string" ? String(value) : File(value->_asFile) | |||
| ->Array.map(value => { | |||
| typeof(value) === #string ? String(value) : File(value->_asFile) | |||
| }) | |||
| } | |||
Member
There was a problem hiding this comment.
why don't you use untagged variants here?
module FormData = {
type t
@unboxed
type formValue =
| String(string)
| File(Js.File.t)
@new external make: unit => t = "FormData"
@send external append: (t, string, ~filename: string=?) => unit = "append"
@send external delete: (t, string) => unit = "delete"
@return(nullable) @send external get: (t, string) => option<formValue> = "get"
@send external getAll: (t, string) => array<formValue> = "getAll"
let getString = (formData, name) => {
switch formData->get(name) {
| Some(String(value)) => Some(value)
| _ => None
}
}
let getFile = (formData, name) => {
switch formData->get(name) {
| Some(File(value)) => Some(value)
| _ => None
}
}
@send external set: (string, string) => unit = "set"
@send external has: string => bool = "has"
// @send external keys: t => Iterator.t<string> = "keys";
// @send external values: t => Iterator.t<value> = "values";
}
Member
Author
There was a problem hiding this comment.
Because I do not care about the existing code. At lot of it can be improved, this is not what this PR is about.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I would like to start creating some alphas of a v12+ world