16 lines
342 B
Text
16 lines
342 B
Text
=== tests/cases/compiler/indexClassByNumber.ts ===
|
|
// Shouldn't be able to index a class instance by a number (unless it has declared a number index signature)
|
|
|
|
class foo { }
|
|
>foo : foo
|
|
|
|
var f = new foo();
|
|
>f : foo
|
|
>new foo() : foo
|
|
>foo : typeof foo
|
|
|
|
f[0] = 4; // Shouldn't be allowed
|
|
>f[0] = 4 : number
|
|
>f[0] : any
|
|
>f : foo
|
|
|