I would like to define a function with a rest parameter of either strings or objects, signature like:
public static fn(...messages: string[] | object[]): void;
But unfortunately this results in a TS2370 compile error
error TS2370: A rest parameter must be of an array type.
I know having a single type of array like string[] or object[] works fine, but then overloading such function comes with even greater price.
Is there anyway I could make the mentioned function working with the desired signature?