`7[2]` is valid Javascript, so it is also valid TypeScript (fetching the '2' member of the `7` object).
Detecting null expressions at compile time might help. There are "nullable" types, but afaik only in signatures:
foo(x?) {
alert(x);
}
If `x` is not passed in, it will be `undefined`.