Description
Currently the string indexer is currently set to readonly in lib.d.ts. When trying to swap out characters in a string, you must cast to any to solve. Is this expected behavior, or a side effect of some other issue being solved?
This is not an issue for Array, as it's indexer is mutable.
https://github.com/Microsoft/TypeScript/blob/master/lib/lib.es5.d.ts#L442
https://github.com/Microsoft/TypeScript/blob/master/lib/lib.es6.d.ts#L442
https://github.com/Microsoft/TypeScript/blob/master/lib/lib.d.ts#L442
TypeScript Version: 1.8.0 / nightly (2.0.0-dev.201xxxxx)
2.1.0-dev.20160801
Code
let rangeValue = '1234567890123'
if (rangeValue.length > 1) {
rangeValue[0] = 'V';
}
Expected behavior:
Should be able to assign a value to any index of a string;
Actual behavior:
Get compiler error Left-hand side of assignment expression cannot be a constant or a read-only property.