Using a minimal typescript project, parcel
will not display errors that typescript catches.
Babel is not used in the example I gave but could be easily put in.
parcel
should display errors caught by typescript in two places.
Also, parcel
should honor noEmitOnError
in tsconfig.json
and not output compiled code if an error is found when running parcel build
No errors are displayed and the project builds even when noEmitOnError
is set to true
I have been trying to integrate parcel with a medium size typescript project I have, however it swallows typescript errors.
https://github.com/kaw2k/parcel-typescript-errors
| Software | Version(s) |
| ---------------- | ---------- |
| Parcel | v1.4.1
| Node | v8.2.1
| npm/Yarn | Yarn
| Operating System | OSX High Sierra
I think this will work if u use the full typescript support plugin https://github.com/fathyb/parcel-plugin-typescript
This should however still get into the core eventually i guess
@DeMoorJasper that plugin still emits on error, I filed an issue: https://github.com/fathyb/parcel-plugin-typescript/issues/9
Edit: this issue is now fixed and the plugin does not emit using noEmitOnError
.
It's really unfortunate to have grave bugs (this bug in Parcel itself and fathyb/parcel-plugin-typescript#59 ) which make Parcel unusable for TypeScript projects.
The parcel-plugin-typescript
seems to be completely broken. It doesn't just fail to report any type errors, but it also breaks parcel build
. When I install this plugin, I start getting this error:
Why closing this request?
Ignoring errors defeats the puprose of using TypeScript. Thus the advertised TypeScript "support" is misleading.
@fathyb is the plugin author
I hope Parcel 2 will have better Typescript support.
FYI, this issue is now getting tracked as part of #1378
If it helps anyone else, this is the workaround I came up with after reading through this issue and all the other ones related to Typescript support trying to find a solution.
Use the concurrently
package (npm i -D concurrently
) and then in package.json
:
"scripts": {
"dev": "concurrently --kill-others \"npm:compile:watch\" \"npm:dev:server\"",
"dev:server": "parcel ./src/index.html --https --out-dir artifacts/obj",
"compile:watch": "tsc -p . --noEmit --watch",
}
Then npm run dev
will output something like:
01:20:35 - File change detected. Starting incremental compilation...
[compile:watch] 01:20:35 - Found 0 errors. Watching for file changes.
[dev:server] โ Built in 605ms.
01:20:55 - File change detected. Starting incremental compilation...
[dev:server] โ Built in 637ms.
[compile:watch] src/components/AppRoot.tsx(69,14): error TS2304: Cannot find name 'Counter'.
[compile:watch] 01:20:55 - Found 1 error. Watching for file changes.
It doesn't fail the Parcel build, but I personally don't care as it only takes a few hundred milliseconds.
Most helpful comment
Why closing this request?
Ignoring errors defeats the puprose of using TypeScript. Thus the advertised TypeScript "support" is misleading.