Incompatible with TypeScript projects
See original GitHub issueTypeScript does not support imports like import x from './index/xyz'
(you’re trying to import ./index/xyz.tsx
here) when there is also a directory called index/xyz/
because it compiles the code to import x from './index/xyz/index.js
. Normally I’d just include the file extension .tsx
but TypeScript hates that.
Example of a project that would break TypeScript with './index/App'
import:
src/
├── index
│ ├── App
│ │ ├── App.css
│ ├── App.tsx
│ ├── index.css
└── index.tsx
That part is a purely TypeScript problem that I don’t know why they thought of that as a feature but I found a workaround after asking around. Replace .tsx
with .js
when writing the import and it works flawlessly.
import App from './index/App.js'; // but we're really importing ./index/App.tsx
This was fine until I ran Destiny again. Destiny doesn’t have a way to resolve the .js
extension to the .tsx
extension (understandably so, I blame TypeScript in this mess) therefore I’m unable to use TypeScript alongside Destiny, it seems to be one or the other (or constantly change file extensions in imports to satisfy one then the other).
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:6
I’m gonna close this for now as it seems that this is a Snowpack specific problem
I didn’t open an issue yet, seems like something that TypeScript isn’t going to want to change but I can open one up and see what happens. And I’ll see what I can do about making a repro for this