iTranslated by AI

The content below is an AI-generated translation. This is an experimental feature, and may contain errors. View original article
🐕

Tips for when arrow function generics are recognized as HTML tags

に公開

If highlighting doesn't work correctly depending on the editor, etc., do this.

const double = <T>(v: T): [T, T] => [v, v]
const hello = () => <p>Hello</p>
// ↑ Highlighting is incorrect

Change <T> to <T,>.

const double = <T,>(v: T): [T, T] => [v, v]
const hello = () => <p>Hello</p>
// ↑ OK
GitHubで編集を提案

Discussion