TypeScript/tests/baselines/reference/indexClassByNumber.types

19 lines
368 B
Plaintext
Raw Normal View History

2014-08-15 23:33:16 +02:00
=== 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
2014-08-15 23:33:16 +02:00
var f = new foo();
>f : foo
2014-08-15 23:33:16 +02:00
>new foo() : foo
>foo : typeof foo
2014-08-15 23:33:16 +02:00
f[0] = 4; // Shouldn't be allowed
>f[0] = 4 : number
>f[0] : any
>f : foo
2015-04-13 21:36:11 +02:00
>0 : number
>4 : number
2014-08-15 23:33:16 +02:00