Skip to content

Generic type interpreted as TSX: Expected a semicolon #265

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
joscha opened this issue Aug 26, 2021 · 2 comments
Closed

Generic type interpreted as TSX: Expected a semicolon #265

joscha opened this issue Aug 26, 2021 · 2 comments
Labels
bug Something isn't working upstream

Comments

@joscha
Copy link
Contributor

joscha commented Aug 26, 2021

Describe the bug

Generic types interpreted as TSX (I think?)

Removing the preceding <P extends object> fixes it.

dprint-plugin-typescript version: 0.51.0

Input Code

const x = <P extends object>(a: React.ComponentType<P>): React.ComponentType<P & { a: string }> => React.memo();

Expected Output

const x = <P extends object>(a: React.ComponentType<P>): React.ComponentType<P & { a: string }> =>
    React.memo();

Actual Output

Line 1, column 95: Expected a semicolon

  pe<P & { a: string }> => React.
                      ~

Playground link: https://dprint.dev/playground/#code/MYewdgzgLgBAHjAvDAPABRgUzlTYAmEMIARgFabBQB8AFAIYBcMASpvVQHQDCIAtgAdweKABUAngMzpqASmZsOUHvyFgREqehgAyGAG8YTGNABOASzABzGAF9qSB4q59MfELVkBuIA/language/typescript

@dsherret
Copy link
Member

Opened swc-project/swc#2161

@joscha
Copy link
Contributor Author

joscha commented Aug 27, 2021

a fix for this just landed in swv via swc-project/swc#2166 \o/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working upstream
Projects
None yet
Development

No branches or pull requests

2 participants