You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Parcel does not generate an error if I try to import a file that does not exist. In addition, importing a Typescript file with type aliases does not seem to make the new types available, causing no errors to pop up when the types are misused.
I have included, below, all the files needed to reproduce my issue.
{"name": "error","version": "1.0.0","scripts": {"test": "echo \"Error: no test specified\" && exit 1"},"keywords": [],"author": "","license": "ISC","description": "","devDependencies": {"parcel": "^2.12.0","typescript": "^5.6.3"}}
🤔 Expected Behavior
If I run ts-node index.ts, I get these errors:
index.ts:2:21 - error TS2307: Cannot find module './bad' or its corresponding type declarations. index.ts:5:19 - error TS2322: Type 'number' is not assignable to type 'string'. index.ts:5:36 - error TS2322: Type 'string' is not assignable to type 'number'. index.ts:6:5 - error TS2739: Type '{}' is missing the following properties from type 'Good': stringVal, numberVal
This is the expected behavior.
😯 Current Behavior
If I run the same code with parcel index.html, no errors pop up, and I can load the page served by Parcel just fine. The objects will all be constructed properly, despite their definitions being incompatible with the definition on good.ts, ./bad not existing and the definition of Bad not being present.
💁 Possible Solution
I assume this issue is related to tree shaking, causing the imports to never happen. I couldn't find a way to disable tree shaking.
🔦 Context
I am just trying to get started with Parcel, so I assume it's something that I'm doing wrong. Any solutions or workarounds are appreciated.
🐛 bug report
Parcel does not generate an error if I try to import a file that does not exist. In addition, importing a Typescript file with type aliases does not seem to make the new types available, causing no errors to pop up when the types are misused.
I have included, below, all the files needed to reproduce my issue.
🎛 Configuration (.babelrc, package.json, cli command)
package.json
🤔 Expected Behavior
If I run
ts-node index.ts
, I get these errors:index.ts:2:21 - error TS2307: Cannot find module './bad' or its corresponding type declarations.
index.ts:5:19 - error TS2322: Type 'number' is not assignable to type 'string'.
index.ts:5:36 - error TS2322: Type 'string' is not assignable to type 'number'.
index.ts:6:5 - error TS2739: Type '{}' is missing the following properties from type 'Good': stringVal, numberVal
This is the expected behavior.
😯 Current Behavior
If I run the same code with
parcel index.html
, no errors pop up, and I can load the page served by Parcel just fine. The objects will all be constructed properly, despite their definitions being incompatible with the definition ongood.ts
,./bad
not existing and the definition ofBad
not being present.💁 Possible Solution
I assume this issue is related to tree shaking, causing the imports to never happen. I couldn't find a way to disable tree shaking.
🔦 Context
I am just trying to get started with Parcel, so I assume it's something that I'm doing wrong. Any solutions or workarounds are appreciated.
💻 Code Sample
index.html
index.ts
good.ts
🌍 Your Environment
Node 20.18.0, Parcel 2.12.0
The text was updated successfully, but these errors were encountered: