Skip to content

Arrow function with generic is confused with JSX tag #46765

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
reggi opened this issue Nov 10, 2021 · 3 comments
Closed

Arrow function with generic is confused with JSX tag #46765

reggi opened this issue Nov 10, 2021 · 3 comments
Labels
Duplicate An existing issue was already created

Comments

@reggi
Copy link

reggi commented Nov 10, 2021

Bug Report

πŸ”Ž Search Terms

react typescript generic anonymous function

πŸ•— Version & Regression Information

Latest version

⏯ Playground Link

https://www.typescriptlang.org/play?#code/G4QwTgBAFgpgNnA9hAvBAPAFQHwAoQBcEmAlKthAC5gCuMQA

πŸ’» Code

var hello = <T>(a: T) => true

πŸ™ Actual behavior

Seems like typescript thinks that generic is JSX tag

πŸ™‚ Expected behavior

Typescript would realize that this is a generic and not JSX tag

@reggi
Copy link
Author

reggi commented Nov 10, 2021

If you add extends does work var hello = <T extends any>(a: T) => true

@MartinJohns
Copy link
Contributor

Duplicate of #15713.

@andrewbranch andrewbranch added the Duplicate An existing issue was already created label Nov 11, 2021
@typescript-bot
Copy link
Collaborator

This issue has been marked as a 'Duplicate' and has seen no recent activity. It has been automatically closed for house-keeping purposes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

4 participants