Integration Compiler Options
Learn how to configure TypeScript compiler options to include JavaScript files and generate distributable JavaScript files.
We'll cover the following
There are a few compiler options that we can configure in order to help with the integration of JavaScript and TypeScript. These options will allow us to include JavaScript files within the same project as TypeScript files, as well as allowing us to do some type checking on JavaScript files.
We are also able to generate declaration files from our TypeScript code if we are building libraries for general consumption.
We will explore these compiler options.
The allowJs
and outDir
options
The default TypeScript compilation configuration, as seen in the tsconfig.json
file, will generate JavaScript files in the same directory as the source TypeScript files.
The outDir
compilation option is used to specify a different output directory for the generated JavaScript:
Get hands-on with 1400+ tech skills courses.