Files
ValueScript/inputs/passing/const/violateWithCustomMethod.ts
2023-05-31 12:18:32 +10:00

17 lines
238 B
TypeScript

//! test_output(E: TypeError{"message":"Cannot mutate this because it is const"})
export default function () {
const foo = new Foo();
foo.inc(); // Should throw
return foo.x;
}
class Foo {
x = 0;
inc() {
this.x++;
}
}