Closed
Description
TypeScript Version: 2.6.1 && 2.7.0-dev.20171207
Code
interface InternalProps {
a: number;
}
interface ExternalProps {
b: string;
}
function make<T = {}>(arg: T & InternalProps): T & ExternalProps {
return 1 as any;
}
const x = make<{}>({a: 1});
console.log(x.a); // Correct: type error
const y = make({a: 1});
console.log(y.a); // Incorrect: no type error
Expected behavior:
Property a
should not be expected to exist on y
.
Both examples should fail.
Actual behavior:
Only first example is considered a type error.