Please sign in to comment.
Read-only arrays cannot be written to with any-typed indexes, and bet…
…ter errors Summary: Before we could write to a `$ReadOnlyArray` if the index was any-typed, like `declare var x: $ReadOnlyArray<number>; x[(42: any)] = 99;`. This seems wrong: read-onlyness is a property of the array, so why should we be able to write to it at all? It would be like saying that you can call a number as if it were a function if you passed it `(42: any)` as an argument. This diff removes this behavior. Additionally, the error message generated from writing to a read only array refers to writing to a tuple with an unknown indexer. This doesn't really apply in the situation, so I've added a new error message for writing to a read-only array specifically. Reviewed By: dsainati1 Differential Revision: D14783752 fbshipit-source-id: 4239f397fe857775bbd029c3141498257a66963e
- Loading branch information...
Showing with 59 additions and 8 deletions.