Skip to content

Parsing Bug #18711

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

Closed
ccorcos opened this issue Sep 23, 2017 · 4 comments
Closed

Parsing Bug #18711

ccorcos opened this issue Sep 23, 2017 · 4 comments
Labels
Duplicate An existing issue was already created

Comments

@ccorcos
Copy link

ccorcos commented Sep 23, 2017

TypeScript Version: 2.5.2

Code

The following code doesn't parse correctly and Typescript thinks f is trying to be a function. This is particularly annoying when Prettier formats my code this way...

const f: (x: any) => any

const x = (
	f([
		() => {
			return 1
		},
		() => {
			return 2
		}
	])
	.catch(error => {
		
	})
)

Example here

Expected behavior:

Actual behavior:

@ccorcos
Copy link
Author

ccorcos commented Sep 23, 2017

I should note that prettier 1.5 did this, not 1.7

@jwbay
Copy link
Contributor

jwbay commented Sep 23, 2017

Slightly smaller repro here. Interestingly removing the second or third line break can fix it

(
    f([
        () => { },
        () => { }
    ])
)

(Your playground link is a bit malformed btw, some extra #src stuff mixed in)

@DanielRosenwasser
Copy link
Member

DanielRosenwasser commented Sep 23, 2017

Seems to be working for me. Can you try our nightlies (i.e. npm install typescript@next)? This is probably a duplicate of #18123.

@DanielRosenwasser DanielRosenwasser added the Duplicate An existing issue was already created label Sep 23, 2017
@ccorcos
Copy link
Author

ccorcos commented Sep 25, 2017

Sounds good to me!

@ccorcos ccorcos closed this as completed Sep 25, 2017
@microsoft microsoft locked and limited conversation to collaborators Jun 14, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

3 participants