Skip to content

Commit

Permalink
Fix Js.String.match_ return type
Browse files Browse the repository at this point in the history
Javscript String.prototype.match function can
return undefineds for optional capture groups
that are not found, which breaks the type annotations
since this is not added as a Js.nullable, it's not
possible to deal with those undefined values since
it can't be passed to Js.Nullable.isNullable.
  • Loading branch information
renatoalencar committed Apr 13, 2021
1 parent d5d46b3 commit 4f3126c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion jscomp/others/js_string.ml
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ external localeCompare : t -> float = "localeCompare" [@@bs.send.pipe: t]
]}
*)
external match_ : Js_re.t -> t array option = "match" [@@bs.send.pipe: t] [@@bs.return {null_to_opt}]
external match_ : Js_re.t -> t Js.nullable array option = "match" [@@bs.send.pipe: t] [@@bs.return {null_to_opt}]

(** [normalize str] returns the normalized Unicode string using Normalization Form Canonical (NFC) Composition.
Expand Down

0 comments on commit 4f3126c

Please sign in to comment.