#At least 2 args

4 messages · Page 1 of 1 (latest)

lusty hazel
#

hey guys is there a way to make a function callable only with at least 2 arguments. And when its less than 2 then we error.

scenic moss
#

yes, but usually people go much further than that and specify the exact argument types

#

what is the function in question?

#

here's a direct answer to your question:

function f(first: unknown, second: unknown, ...rest: unknown[]) {}