From 713ab6cdb1644fb44e2c0c8fdcbef31007b37b8d Mon Sep 17 00:00:00 2001 From: Antonio Nuno Monteiro Date: Sat, 22 Jun 2024 19:33:34 -0700 Subject: [PATCH] remove unused `[@mel.uncurry]` attributes (#841) --- src/React.re | 10 ++++++---- src/React.rei | 10 +++++----- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/React.re b/src/React.re index 45071cda2..33d1c3451 100644 --- a/src/React.re +++ b/src/React.re @@ -464,6 +464,9 @@ external displayName: component('props) => option(string) = "displayName"; /* HOOKS */ +/* This is used as return values */ +type callback('input, 'output) = 'input => 'output; + /* * Yeah, we know this api isn't great. tl;dr: useReducer instead. * It's because useState can take functions or non-function values and treats @@ -488,13 +491,13 @@ external useReducerWithMapState: 'initialState, [@mel.uncurry] ('initialState => 'state) ) => - ('state, 'action => unit) = + ('state, callback('action, unit)) = "useReducer"; [@mel.module "react"] external useSyncExternalStore: ( - ~subscribe: ([@mel.uncurry] (unit => unit)) => [@mel.uncurry] (unit => unit), + ~subscribe: (unit => unit) => callback(unit, unit), ~getSnapshot: unit => 'snapshot ) => 'snapshot = @@ -503,7 +506,7 @@ external useSyncExternalStore: [@mel.module "react"] external useSyncExternalStoreWithServer: ( - ~subscribe: ([@mel.uncurry] (unit => unit)) => [@mel.uncurry] (unit => unit), + ~subscribe: (unit => unit) => callback(unit, unit), ~getSnapshot: unit => 'snapshot, ~getServerSnapshot: [@mel.uncurry] (unit => 'snapshot) ) => @@ -866,7 +869,6 @@ module Uncurried = { "useCallback"; }; -type callback('input, 'output) = 'input => 'output; [@mel.module "react"] external useTransition: unit => (bool, callback(callback(unit, unit), unit)) = "useTransition"; diff --git a/src/React.rei b/src/React.rei index f24d7273f..7f2f91273 100644 --- a/src/React.rei +++ b/src/React.rei @@ -183,10 +183,13 @@ external useReducerWithMapState: ('state, 'action => unit) = "useReducer"; +/* This is used as return values */ +type callback('input, 'output) = 'input => 'output; + [@mel.module "react"] external useSyncExternalStore: ( - ~subscribe: ([@mel.uncurry] (unit => unit)) => [@mel.uncurry] (unit => unit), + ~subscribe: (unit => unit) => callback(unit, unit), ~getSnapshot: unit => 'snapshot ) => 'snapshot = @@ -195,7 +198,7 @@ external useSyncExternalStore: [@mel.module "react"] external useSyncExternalStoreWithServer: ( - ~subscribe: ([@mel.uncurry] (unit => unit)) => [@mel.uncurry] (unit => unit), + ~subscribe: (unit => unit) => callback(unit, unit), ~getSnapshot: unit => 'snapshot, ~getServerSnapshot: [@mel.uncurry] (unit => 'snapshot) ) => @@ -382,9 +385,6 @@ external useMemo7: ([@mel.uncurry] (unit => 'any), ('a, 'b, 'c, 'd, 'e, 'f, 'g)) => 'any = "useMemo"; -/* This is used as return values */ -type callback('input, 'output) = 'input => 'output; - [@mel.module "react"] external useCallback: 'fn => 'fn = "useCallback"; [@mel.module "react"] external useCallback0: ('fn, [@mel.as {json|[]|json}] _) => 'fn =