-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Closed
Labels
Breaking ChangeWould introduce errors in existing codeWould introduce errors in existing codeFixedA PR has been merged for this issueA PR has been merged for this issueSuggestionAn idea for TypeScriptAn idea for TypeScript
Milestone
Description
TypeScript Version: 2.1? (Playground)
Code
interface Props {
foo: string;
bar: string;
}
const p: Props = {
foo: 'hello',
bar: 'world'
}
const say = (props: Props) => console.log(`${props.foo.length} ${props.bar.length}`);
say(p);
delete p.bar;
say(p); // works, but should throw
See here.
Expected behavior:
Don't compile, because we delete
bar
from p
.
Actual behavior:
Compiles. Resulting in a runtime error: Uncaught TypeError: Cannot read property 'length' of undefined
.
kputh, AntoineEsteve, sindresorhus, AlexAtHome, ryanberckmans and 20 more
Metadata
Metadata
Assignees
Labels
Breaking ChangeWould introduce errors in existing codeWould introduce errors in existing codeFixedA PR has been merged for this issueA PR has been merged for this issueSuggestionAn idea for TypeScriptAn idea for TypeScript