I have a function that crashes if the parameter sent is the instance of any class or is a Function.
So I need to write a Type that shows a compile-time error if we try to pass an instance of a class to that function.
I tried the following but it can disallow only Function
// type Disallowed = instanceof any
type Disallowed = Function
type Input<T> = T & (T extends Disallowed ? never : T);
// Accepts anything number, string, bool, json object, ... except instance of class and functions
function saveData<T>(data: Input<T> ) { ... }
class A {}
let foo = new A{}
saveData(foo) // should produce compile error
saveData(()=>{}) // already dissallowed