Closed
Description
TypeScript Version: 3.5.0-dev.20190517
Search Terms:
TS2536
Type cannot be used to index type 'this'.
Code
export class c {
[x: string]: string;
constructor() {
this["a"] = "b";
}
}
Expected behavior:
No errors
Actual behavior:
error TS2536: Type '"a"' cannot be used to index type 'this'.
Playground Link:
Works fine in playground but fails in 3.5.0.rc
https://www.typescriptlang.org/play/#src=class%20y%20%7B%0D%0A%20%20%20%20%5Bx%3A%20string%5D%3A%20string%3B%0D%0A%20%20%20%20constructor()%20%7B%0D%0A%20%20%20%20%20%20%20%20this%5B%22b%22%5D%20%3D%20%22a%22%3B%0D%0A%20%20%20%20%7D%0D%0A%7D%0D%0A
Related Issues:
Could not find any