Microsoft/TypeScript

Bad parsing behaviour for generic arrow type arguments in class heritage / JSX open element

Open

#47.410 geöffnet am 12. Jan. 2022

Auf GitHub ansehen
 (0 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)TypeScript (6.726 Forks)batch import
BugDomain: ParserHelp Wanted

Repository-Metriken

Stars
 (48.455 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 6T 17h) (9 gemergte PRs in 30 T)

Beschreibung

Bug Report

🔎 Search Terms

shift left type arguments <<

🕗 Version & Regression Information

  • This is a crash
  • This changed between versions ______ and _______
  • This is the behavior in every version I tried, and I reviewed the FAQ for entries about ____ Generics _____
  • I was unable to test this on prior versions because _______

⏯ Playground Link

Playground link with relevant code

💻 Code

// No parse error.
(class extends f()< <T>(x: T) => T> {});
<Component< <T>(x: T) => T> />;

// Parse error.
(class extends f()<<T>(x: T) => T> {});
<Component<<T>(x: T) => T> />;

🙁 Actual behavior

Parsing error.

🙂 Expected behavior

No parse error. They are equivalent.

Additional Info

Found this issue when working on a similar fix to Babel (https://github.com/babel/babel/pull/14145). This issue is a follow-up to #23996. /cc @Kingwl since you have fixed that issue.

Contributor Guide