Closed
Description
This might be a feature, but it sure is odd. The excess property check is not working on callbacks, e.g.:
interface Test {
name?: string;
}
function myMutator(fn: () => Test) {
return fn();
}
/* Not an error */
let a: Test = myMutator(() => ({
notAProperty : "woot?"
}));
/* This gives error */
function test(): Test {
return {
notAProperty : "what"
}
}
/* This gives error */
let b: Test = {
notAProperty : "huh"
};
Is there a trick to enforce the excess property check in situations like the one above?