How to make typechecker forgot unwanted type?

I have this code

type s<f> = { _: f }
local function f<f, a...>(s: s<f & (a...) -> ()>, ...: a...) end

local a : s<(a: number, b: string) -> ()> = nil
f(a, --[[function f(s: s<((a: **number**, b: string) -> ()) & ((number, string) -> ())>, number, string): ()]])

which let me able to extract the parameter type of (a: number, b: string) -> (), thing is that it shows this whole thing function f(s: s<((a: **number**, b: string) -> ()) & ((number, string) -> ())>, number, string): ()] while I only want this thing function f(s: s<(a: **number**, b: string) -> ()>, number, string) which I think the only way is to somehow do this? type t<f> = { _: f? } where _:f? will doesn’t show or known by typechecker is because of ? which essentially make it doesn’t show, but I can’t seem to get it working somehow or someway? Using old luau solver and also luau lsp but in roblox studio it highlight f(s: s<...>, **number**, string) so theres that

It doesn’t really look like f in s<f & (a...) -> ()> is doing anything useful. It’d be the same as s<(a...) -> ()> if the goal is just to make the variadics in type s match the ones in function f. so you can get what you need.

2 Likes

Well, that could work but it loses the parameter name, which I wanted


versus

Ehhh I think there isn’t a way, guess your answer will do