What exactly are you trying to accomplish? Is the generic T for Parent supposed to contain {T} for both your callback and returned values?
You are using a variadic generic type of T... but as a regular generic type. It’s used for, well, variadic values.
I find it confusing why you are using both a generic and a table for your callback. All {T} is going to return is an array only containing whatever you pass as the Parent argument.
Can you explain to me how this function is supposed to work.
I’m trying to share values from other places. This is what is inside of the function
local Animator: Animator, Animation: Animation;
do
for _, Descendant: any in Parent:GetDescendants() do
if Descendant:IsA("Animator") then
Animator = Descendant;
elseif Descendant:IsA("Animation") then
Animation = Descendant;
end
end
end
return Callback(Animator, Animation);
return {
Attach = function<P, C...>(self: {}, Parent: P, Children: { string }, Callback: (C...) -> (C...)): (C...)
local Descendants: { string } = {};
for _, Descendant: any in Parent:GetDescendants() do
for i = 1, #Children do
if Descendant:IsA(Children[i]) then
table.insert(Descendants, Descendant);
end
end
end
return Callback(table.unpack(Descendants));
end
}