@@ -1461,9 +1461,11 @@ let getArgs ~env (t : Types.type_expr) ~full =
1461
1461
match t.desc with
1462
1462
| Tlink t1 | Tsubst t1 | Tpoly (t1 , [] ) ->
1463
1463
getArgsLoop ~full ~env ~current ArgumentPosition t1
1464
- | Tarrow (( Labelled l | Optional l ) , tArg , tRet , _ ) ->
1464
+ | Tarrow (Labelled l , tArg , tRet , _ ) ->
1465
1465
(SharedTypes.Completable. Labelled l, tArg)
1466
1466
:: getArgsLoop ~full ~env ~current ArgumentPosition tRet
1467
+ | Tarrow (Optional l , tArg , tRet , _ ) ->
1468
+ (Optional l, tArg) :: getArgsLoop ~full ~env ~current ArgumentPosition tRet
1467
1469
| Tarrow (Nolabel, tArg , tRet , _ ) ->
1468
1470
(Unlabelled {argumentPosition = currentArgumentPosition}, tArg)
1469
1471
:: getArgsLoop ~full ~env
@@ -1945,15 +1947,22 @@ Note: The `@react.component` decorator requires the react-jsx config to be set i
1945
1947
| None -> []
1946
1948
in
1947
1949
let targetLabel =
1948
- labels |> List. find_opt (fun (label , _ ) -> label = argumentLabel )
1950
+ labels
1951
+ |> List. find_opt (fun (label , _ ) ->
1952
+ match argumentLabel with
1953
+ | Unlabelled _ -> label = argumentLabel
1954
+ | Labelled name | Optional name -> (
1955
+ match label with
1956
+ | (Labelled n | Optional n ) when name = n -> true
1957
+ | _ -> false ))
1949
1958
in
1950
1959
match targetLabel with
1951
1960
| None -> []
1952
- | Some (Labelled _ , typ ) ->
1961
+ | Some (Optional _ , typ ) ->
1953
1962
typ
1954
1963
|> completeTypedValue ~env ~envWhereCompletionStarted ~full ~prefix
1955
1964
~expandOption :true
1956
- | Some (Unlabelled _ , typ ) ->
1965
+ | Some (( Unlabelled _ | Labelled _ ) , typ ) ->
1957
1966
typ
1958
1967
|> completeTypedValue ~env ~envWhereCompletionStarted ~full ~prefix
1959
1968
~expandOption :false )
@@ -1974,6 +1983,7 @@ Note: The `@react.component` decorator requires the react-jsx config to be set i
1974
1983
|> List. filter_map (fun arg ->
1975
1984
match arg with
1976
1985
| SharedTypes.Completable. Labelled name , a -> Some (name , a )
1986
+ | Optional name , a -> Some (name , a )
1977
1987
| _ -> None)
1978
1988
| None -> []
1979
1989
in
0 commit comments