Closed
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
.