Bug Report
Computed property assignments do not respect corresponding setter signatures.
🔎 Search Terms
variant accessors, setter, computed properties, write type
🕗 Version & Regression Information
- Affected versions: 4.3 to 5.1.6 (current stable).
⏯ Playground Link
Playground Link (5.1.6)
💻 Code
constk=Symbol();constenumProps{k='k',}interfaceFoo{getk(): Set<string>;setk(v: Iterable<string>);get[k](): Set<string>;set[k](v: Iterable<string>);}declareconstfoo: Foo// OK:foo.k=['it','works'];// Errors:foo['k']=['should','work'];foo[Props.k]=['but','actually'];foo[k]=['does','not']// Getters work as expected:constvalues=[foo.k,foo['k'],foo[Props.k],foo[k]]asconst;// ^? const values: readonly [Set<string>, Set<string>, Set<string>, Set<string>]🙁 Actual behavior
Getter type is used at the LHS of an indexed/computed property assignment.
🙂 Expected behavior
Setters should accept their declared types.
Bug Report
Computed property assignments do not respect corresponding setter signatures.
🔎 Search Terms
variant accessors, setter, computed properties, write type
🕗 Version & Regression Information
⏯ Playground Link
Playground Link (5.1.6)
💻 Code
🙁 Actual behavior
Getter type is used at the LHS of an indexed/computed property assignment.
🙂 Expected behavior
Setters should accept their declared types.