Weird behavior with pcall when using "--!strict"

With --!strict, pcall gives a warning:

Type Error: Function only returns 1 value, but 2 are required here

but without --!strict it does not give one.

--!strict

local T = {}
function T.Active(...)
	print("hey, I want say: ", ...)
end

local success, err = pcall(T.Active, "something wrong", "with pcall?")

image

image


Expected behavior

No warn since according to the documentation pcall returns 2 values.

3 Likes

Why was this closed?? It’s still an issue.
Here’s an Issue describing the same behavior on the luau GitHub.

1 Like

Idk, maybe it’s “expected” or already written down somewhere.
(message late and this problem remains-)

--!strict

local T = {}
function T.Active(...)
	print("hey, its me again:", ...)
end

local success, err = pcall(T.Active, "something wrong", "with pcall?")

1 Like

Hi there, sorry about the confusion, and thanks for the report! I don’t know who marked this as by design, but while it is expected, we do consider it a bug that we would like to fix eventually. I’ve placed it on our backlog.

2 Likes

excited-cat

Thanks you.