Microsoft/TypeScript
在 GitHub 查看Using JSX syntax in a namespace may incorrectly use the exported members of the current namespace as intrinsic elements (starting with a lowercase letter)
Open
#60,365 建立於 2024年10月29日
BugDomain: JSX/TSXHelp Wanted
倉庫指標
- Star
- (48,455 star)
- PR 合併指標
- (平均合併 6天 17小時) (30 天內合併 9 個 PR)
描述
🔎 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
💻 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