Parcel: Can It Support Typescript?

Created on 9 Dec 2017  路  13Comments  路  Source: parcel-bundler/parcel

As My Title If It Support Typescript How To Config It

Question

Most helpful comment

All 13 comments

It supports typescript, no need to config anything though.
Just point it to a index.html or whatever html file that has a script tag containing the typescript entrypoint and everything should work automagically

Or directly at the index.js or is a .html file always required?

It can also be a js file or pointing it directly at a Typescript file also works

Right, because this also worked for me as our projects are not included in an index.html document at compile time.

I am not sure if it was mentioned in the docs / get startet that the given entry file can be also one of the many supported ecmascript subsets.

Just saw the example with the index.html.

@jimmycarry if these answers resolved your question, could you close the issue?

@DeMoorJasper OK

Seems like one needs to rename the file from *.ts to *.tsx to support the JSX syntax? Otherwise parcel will complain " Unterminated regular expression" for the first encountered JSX tag.

I tried converting nodejs to parcel for this and dist folder just skipped ts files.

PS: didn't target ts files

For the record, while ParcelJS technically supports TypeScript, it ignores all errors in your code. This is a big deal for (at least some) TypeScript users. If you want errors, you need to use a plugin, but that also didn't work out for us due to a bug in that plugin. I personally wouldn't recommend it for TypeScript projects at this time, as impressive as the build times are.

I suppose using VSCode is good enough to identifying type errors. I belief typescript itself doesn't actually stop compilation on type error.

It doesn't work without configuration if you want to use react and TS

Was this page helpful?
0 / 5 - 0 ratings