-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Closed
Labels
Design LimitationConstraints of the existing architecture prevent this from being fixedConstraints of the existing architecture prevent this from being fixedFix AvailableA PR has been opened for this issueA PR has been opened for this issueSuggestionAn idea for TypeScriptAn idea for TypeScriptToo ComplexAn issue which adding support for may be too complex for the value it addsAn issue which adding support for may be too complex for the value it adds
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?
Metadata
Metadata
Assignees
Labels
Design LimitationConstraints of the existing architecture prevent this from being fixedConstraints of the existing architecture prevent this from being fixedFix AvailableA PR has been opened for this issueA PR has been opened for this issueSuggestionAn idea for TypeScriptAn idea for TypeScriptToo ComplexAn issue which adding support for may be too complex for the value it addsAn issue which adding support for may be too complex for the value it adds