I am trying to create a function fun
that takes a wrapped designated object. I've wrapped it in Example
.
export class Example {
private __ExampleFlag;
constructor (input) {
Object.assign(this, input);
}
}
Here's the function:
const fun = (e: Example): boolean => {
return true;
};
This does not work, which is good:
fun({}); // no good
This works, which is good:
fun(new Example({})); // good
This works, which NOT is good:
const v:any = {};
fun(v); // not good
How can I have any not match Example? Haveing a more strict type?