Bug Report
🔎 Search Terms
variant accessor setter union
🕗 Version & Regression Information
- I was unable to test this on prior versions because: variant accessors only landed in 4.3
⏯ Playground Link
Example from below
💻 Code
class One {
get prop(): string { return ""; }
set prop(s: string | number) { }
}
class Two {
get prop(): string { return ""; }
set prop(s: string | number) { }
}
declare const u1: One|Two;
u1.prop = 42; //Type 'number' is not assignable to type 'string'.(2322)
I didn't include it in the playground, but behavior is the same for class or interface.
🙁 Actual behavior
Assignment of number is flagged as an error, even though both sides of the union allow assignment of a number.
🙂 Expected behavior
Assignment should not be flagged.
Originally reported by @ws93
Bug Report
🔎 Search Terms
variant accessor setter union
🕗 Version & Regression Information
⏯ Playground Link
Example from below
💻 Code
I didn't include it in the playground, but behavior is the same for
classorinterface.🙁 Actual behavior
Assignment of number is flagged as an error, even though both sides of the union allow assignment of a number.
🙂 Expected behavior
Assignment should not be flagged.
Originally reported by @ws93