Fixed bug where type queries (typeof) worked on interface members.

Originally the following code would compile cleanly:

    interface N {
        y: number;
        x: typeof y; // Should be error (y is not a value)
    }

This fix also revealed what appeared to be an error with the language
service, in which identifiers of method/property signatures were not
treated as such.
Added test case for type queries within interfaces.
Added tests, moved the scope check towards the beginning of the loop.