fix(utils): add callback type to do_or_fail
See https://github.com/teal-language/tl/issues/569
This commit is contained in:
parent
e8f38978dd
commit
66712f891a
|
@ -56,8 +56,7 @@ function utils.sanitize_string(s: string): string
|
||||||
end
|
end
|
||||||
|
|
||||||
-- At some point, we should probably write a wrapper to make penlight's function work with pcalls.
|
-- At some point, we should probably write a wrapper to make penlight's function work with pcalls.
|
||||||
local type Func = function<T>(...: any): T | nil, string
|
function utils.do_or_fail<T>(func: function<T>(...: any): (T | nil, string), ...: any): T
|
||||||
function utils.do_or_fail<T>(func: Func<T>, ...: any): T
|
|
||||||
local log = require "logger"
|
local log = require "logger"
|
||||||
local res, err = func(...)
|
local res, err = func(...)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue