[TypeScript] Ensure params not accept certain type
Let's say we have a function accept any type but array.
function anyTypesButNotArray<T>( val: T extends any[] ? "you should not pass in array" : T ) { return val; } anyTypesButNotArray(["sf", "sdf"]);