microsoft / microsoft/TypeScript
Auto-closing of tags within curly braces `{}` does not work when parent element is same tag in JSX
Nessuno ha ancora preso questa issue.
- Lingua principale
- Go
- Stelle
- 111k
- Fork
- 14.3k
- Merge medio
- 1g 19h
- PR unite (30g)
- 117
Descrizione
🔎 Search Terms
typescript javascript jsx auto close closing div tag curly brackets braces
🕗 Version & Regression Information
- This is the behavior in every version I tried, and I reviewed the FAQ for entries about JSX auto-closing
⏯ Playground Link
💻 Code
import React from "react"
const Component = () => {
const foo = false
return (
<div> // this has to be a div, changing it to another tag (e.g. <main>) corrects the functionality of closing tag below
{foo && <div>} // does not auto close div here
</div>
)
}
🙁 Actual behavior
When working with JSX (both in TypeScript and JavaScript), the auto-closing functionality for HTML tags does not work as expected within curly braces {}. The closing tag (e.g., ) is not automatically inserted when opening a tag inside curly braces when the outer or parent element tag is the same.
🙂 Expected behavior
The auto-closing functionality should work for HTML tags within curly braces {} in JSX, just like it does for tags outside of curly braces. When opening a tag (e.g., <div>) within curly braces, the closing tag (e.g., </div>) should be automatically inserted even when parent element tag is the same.
Additional information about the issue
No response
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia riproducendo l’esempio JSX nel TypeScript Playground collegato, confrontando gli elementi esterno e interno quando i loro tag coincidono rispetto a quando differiscono. Traccia il comportamento di chiusura automatica delle espressioni JSX negli strumenti TypeScript pertinenti, quindi verifica che un tag di apertura all’interno di parentesi graffe riceva il relativo tag di chiusura anche quando l’elemento padre usa lo stesso tag.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- javascript, react, typescript
- Ambito
- tooling
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Attiva
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 50/100