Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Composition with optional chaining #8

Open
kesne opened this issue Jul 25, 2019 · 3 comments
Open

Composition with optional chaining #8

kesne opened this issue Jul 25, 2019 · 3 comments

Comments

@kesne
Copy link

kesne commented Jul 25, 2019

Assuming that optional chaining advances, this proposal will need to be able to work with optional chains.

@erights
Copy link
Collaborator

erights commented Jul 25, 2019

Timely! Thanks for raising this. I will mention this in my upcoming presentation.

And agreed of course. These must be able to be used together.

@caub
Copy link

caub commented Aug 2, 2019

good point

// current valid syntaxes with optional-chaining and infix-bang
const foo = (await (await fetch(url)).json())?.foo // the json response could be "null"
const foo = (await fetch(url)!json())?.foo

// some ideas
const foo = await fetch(url)!json()!?foo // this ?
const foo = await fetch(url)!json()?!foo // that ?
const foo = await fetch(url)!json()!.foo // or that to keep similarity with optional-chaining dot?

@KristjanTammekivi
Copy link

Just a quick note that !. should be considered unsuitable because it has a meaning in TypeScript as non-null assertion operator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants