microsoft / microsoft/TypeScript

Using JSX syntax in a namespace may incorrectly use the exported members of the current namespace as intrinsic elements (starting with a lowercase letter)

Aperta
#60,365 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Bug Domain: JSX/TSX Help Wanted
Lingua principale
Go
Stelle
111k
Fork
14.4k
Merge medio
1g 19h
PR unite (30g)
117

Descrizione

🔎 Search Terms

jsx namespace preserve export intrinsic

🕗 Version & Regression Information
  • This is the behavior in every version I tried, and I reviewed the FAQ for entries about (no entries for this)
⏯ Playground Link

https://www.typescriptlang.org/play/?jsx=1&ts=5.6.3#code/JYWwDg9gTgLgBAbzgKQMoA04F84DMoQhwBEUApgIYDGMxA3AFBkAekscAdhSGQM5jUyeaEQQM4cFm3hUIHXvGAcwAV3gBeTioA22xhKnQZchXBh8NcADxLV8APQA+cXHv2JHz168A9APwMWAxAA

💻 Code

WITH jsx: preserve enabled in tsconfig.json

export namespace form {
  export const input = null;
  export const test = <input />
}
🙁 Actual behavior

generated code:

export var form;
(function (form) {
    form.input = null;
    form.test = <form.input />;
})(form || (form = {}));
🙂 Expected behavior

generated code:

export var form;
(function (form) {
    form.input = null;
    form.test = <input />;
})(form || (form = {}));
Additional information about the issue

In fact, I observed this problem in a certain version of swc (swc does not support preserve mode, and the problem can be reproduced without enabling preserve mode). Considering that swc largely replicates the behavior of tsc, I suspected that this problem also exists in ts, and it is true, but only in jsx: preserve mode

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia con la riproduzione collegata di TypeScript Playground usando jsx: conserva il JavaScript emesso e confrontalo con l'output previsto. Traccia la trasformazione JSX degli elementi intrinseci in minuscolo all'interno di un namespace esportato. Il lavoro è completato quando l'input esportato del namespace rimane invece di diventare <form.input />, con un test di regressione che copra la riproduzione.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
typescript
Ambito
compilers
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Specificata chiaramente
Idoneità per principianti
42/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.