Closed
Description
TypeScript Version: 2.4.0
Code
interface ITest {
optional?: string;
}
function test(param: ITest): void {
}
class Test {
}
test({ whatever: 0, optional: "" }); //<-- compiler doesn't allow this
test(test); //<-- compiler allows this
test(Test); //<-- compiler allows this
test(new Test()); //<-- compiler allows this
Expected behavior:
Passing any object of any type that doesn't match with at least one of the properties defined in the weak type, should fail.
Actual behavior:
Only object literals that don't at least partially match are not allowed to be passed.