Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does Typescript --allowJs work?

Tags:

typescript

I have read:

but I still don't get how it works and what it is good for. Could someone please explain what it is and when I would want to use it?

like image 592
Oskar Avatar asked Oct 17 '16 14:10

Oskar


1 Answers

From Clay Allsopp on Medium:

allowJs is the option newly available in 1.8. The TypeScript compiler will run a quick sanity check on .js files for syntax errors but otherwise passes them straight through to the output directory.

This is useful when migrating a JavaScript project to TypeScript, that way you don't have to migrate everything at once but instead start writing new code in TypeScript and/or migrate each file one by one. You can find more information about migration from JavaScript to Typescript on the official site for TypeScript that has a tutorial called "Migrating from JavaScript".

like image 70
Oskar Avatar answered Nov 14 '22 00:11

Oskar