Skip to content

Commit

Permalink
fix: remove untrue check related to option(_) labelled props
Browse files Browse the repository at this point in the history
  • Loading branch information
anmonteiro committed Oct 19, 2023
1 parent 2499764 commit 3a42848
Showing 1 changed file with 0 additions and 23 deletions.
23 changes: 0 additions & 23 deletions ppx/reason_react_ppx.ml
Original file line number Diff line number Diff line change
Expand Up @@ -641,29 +641,6 @@ let jsxMapper =
API instead.")
| Pexp_fun (arg, default, pattern, expression)
when isOptional arg || isLabelled arg ->
let () =
match (isOptional arg, pattern, default) with
| true, { ppat_desc = Ppat_constraint (_, { ptyp_desc }) }, None -> (
match ptyp_desc with
| Ptyp_constr ({ txt = Lident "option" }, [ _ ]) -> ()
| _ ->
let currentType =
match ptyp_desc with
| Ptyp_constr ({ txt }, []) ->
String.concat "." (Longident.flatten_exn txt)
| Ptyp_constr ({ txt }, _innerTypeArgs) ->
String.concat "." (Longident.flatten_exn txt) ^ "(...)"
| _ -> "..."
in
Ocaml_common.Location.prerr_warning pattern.ppat_loc
(Preprocessor
(Printf.sprintf
"react-jsx-ppx: optional argument annotations must \
have an explicit `option` type. Did you mean \
`option(%s)=?`?"
currentType)))
| _ -> ()
in
let alias =
match pattern with
| { ppat_desc = Ppat_alias (_, { txt }) | Ppat_var { txt } } -> txt
Expand Down

0 comments on commit 3a42848

Please sign in to comment.