Closed mrcaidev closed 1 week ago
I'm open to ideas. I'm not sure I understand what they are trying to say in the TS issue. Admittedly my understanding of TS is very limited.
The linked typescript issue is unrelated, since it's for exports instead of imports, verbatimModuleSyntax means that any imports you write are kept as is, irrespective of whether they're being used as a runtime value or not. The namespace JSX
doesn't exist at runtime, so it should be imported with a type
prefix.
Yeah JSX is just a type for us because we don't use the standard TS JSX transform. Adding the type
prefix does seem to work @mrcaidev. Am I missing any other part of the issue or should we consider this done?
No problem. Thank you all!
Describe the bug
If
verbatimModuleSyntax
is set totrue
intsconfig.json
, namespace imports would crash the whole app. For example:I am aware that this is more like an issue on TypeScript side, and I do find a relevant issue #52461 there. In this issue, TypeScript members suggest a particular way to export namespaces, and the failure of other ways is an expected behavior.
Currently, I can solve this by turning off
verbatimModuleSyntax
to stop my app from crashing. But I'm wondering if this can be avoided on SolidJS side? That is, modifying the style in which namespaces are exported, so that they can become compatible withverbatimModuleSyntax
.Your Example Website or App
https://codesandbox.io/p/devbox/importing-jsx-with-tsconfig-verbatimmodulesyntax-62pnqn
Steps to Reproduce the Bug or Issue
JSX
on line 1:import { createSignal, JSX } from "solid-js";
.Expected behavior
Namespace imports should work along well with
"verbatimModuleSyntax": true
.Screenshots or Videos
Platform
Additional context
Log: