The updateSW is a return of the registerSW, so it is intrinsically external as the registerSW is external. I’m loading it from the Vite PWA plugin, the binding is like
@module("virtual:pwa-register")
external registerSW: registerSWOptions => unit => unit = "registerSW"
and let’s say the registerSWOptions has the type
type registerSWOptions = {foo: React.element}
for simplicity.
I name the return type () => () a updateSW but it is only my assignment.
let updateSW = registerSW({ foo: <button onClick={_ => updateSW() }/> })
Your example would not work, as the updateSW calls registerSW in it’s body, but it should not do that - the updateSW is simply and external function returned by the registerSW.