I was hoping to avoid things like

```js
const baz = this.foo?.bar?.baz
if (baz) baz.lorem = 123
```

#!/JoePea

On Thu, Apr 30, 2020 at 1:04 PM #!/JoePea <[email protected]> wrote:
>
> This is perfectly fine:
>
> ```js
> this.foo?.bar?.setBaz(123)
> ```
>
> but this is not:
>
> ```js
> this.foo?.bar?.baz = 123
> ```
>
> Why is that not allowed, but function calls are?
>
> I find myself often wanting to do assignments like that. When I am
> auto-completing things in VS Code (TypeScript), it automatically and
> awesomely inserts the `?` characters, only to fail once I write the
> assignment part.
>
> #!/JoePea
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to