mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
19 lines
496 B
TypeScript
19 lines
496 B
TypeScript
//// [tests/cases/compiler/indexClassByNumber.ts] ////
|
|
|
|
//// [indexClassByNumber.ts]
|
|
// Shouldn't be able to index a class instance by a number (unless it has declared a number index signature)
|
|
|
|
class foo { }
|
|
|
|
var f = new foo();
|
|
|
|
f[0] = 4; // Shouldn't be allowed
|
|
|
|
//// [indexClassByNumber.js]
|
|
"use strict";
|
|
// Shouldn't be able to index a class instance by a number (unless it has declared a number index signature)
|
|
class foo {
|
|
}
|
|
var f = new foo();
|
|
f[0] = 4; // Shouldn't be allowed
|