local A=require(script.Parent.Parent.lib.t)local b=A.union(A.callback,A.none)local function O(A,...)assert(b(A))if type(A)=="\102\117\110\099\116\105\111\110"then return A(...)end end return O
--[[
	Calls the given function if it actually exists.

	Useful in Roact components where a callback passed as a prop is optional, so
	you don't always know if you want to run it.

	Usage:

		maybeCall(nil) -- does nothing

		maybeCall(function()
			print("Hello!") -- prints hello
		end)
]]

local t = require(script.Parent.Parent.lib.t)

local maybeCallCheck = t.union(t.callback, t.none)
local function maybeCall(callback, ...)
	assert(maybeCallCheck(callback))

	if type(callback) == "function" then
		return callback(...)
	end
end

return maybeCall
