See https://github.com/tc39/proposal-optional-chaining/issues/18
On Thu, Apr 30, 2020 at 1:08 PM #!/JoePea <j...@trusktr.io> wrote: > 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 <j...@trusktr.io> 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 > es-discuss@mozilla.org > https://mail.mozilla.org/listinfo/es-discuss >
_______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss