After intersecting / unioning two tables, it appears that function deprecation info is lost in the process. Other function-related info, such as the function descriptions and types, appear to still be retained.
Take the following code example:
local module = {}
-- Description
@deprecated
function module:foo(arg: string?): number?
return 0
end
local bar = module :: typeof(module) & {}
bar:foo() -- No deprecation warning
bar = bar :: typeof(module)
bar:foo() -- Deprecation warning. "Member 'foo' is deprecated"
In this example, we have a table named module which contains the function foo which is a deprecated function. We later create a new variable named bar and set the type of this to the intersection of module and an empty table. Attempts to run bar:foo() will now no longer provide a deprecation warning, however the function description and other relevant type-related info seems to still be supplied on-hover.
Overriding the type of bar to no longer use an intersection will restore the deprecation warning, as also seen in the code example.
This issue also appears to apply to the setmetatable type function (and potentially other operators)