No inputs were found in config file in TypeScript [Solved]

avatar
Borislav Hadzhiev

Last updated: Feb 29, 2024
3 min

banner

# No inputs were found in config file in TypeScript

The error "No inputs were found in config file" occurs when we try to build a project that doesn't contain any TypeScript files.

To solve the error, add an empty file with a .ts extension in your project's root directory and restart your IDE if necessary.

no inputs were found in config file

shell
tsc # error TS18003: No inputs were found in config file. # Specified 'include' paths were '["**/*"]' and # 'exclude' paths were '["node_modules"]'.

The first thing you need to do is make sure your project contains at least one file with a .ts extension.

If it doesn't, you can create an empty file with a .ts extension to silence the error.

Create a file called placeholder.ts with the following contents.

placeholder.ts
export {};

# Create the file in a directory that is included

If you've set the include array in your tsconfig.json file, make sure to create the file in the specified directory.

tsconfig.json
{ "compilerOptions": { // ... your options }, "include": ["src/**/*"], "exclude": ["node_modules"] }

For example, the include array from the tsconfig.json file above looks for files in the src directory, so you'd have to create the placeholder file in src.

If you haven't set the include array, create the placeholder file in your project's root directory (next to tsconfig.json).

# Restart your IDE and development server

If you already have files in your project, restart your IDE and TypeScript server.

VSCode often glitches and needs a reboot. In that case, open a file with a .ts or .js extension and restart the editor for it to pick it up.

# Make sure you haven't excluded all files from compilation

Another thing that causes the error is if you add all the files in your TypeScript project to the exclude array by mistake.

tsconfig.json
{ "compilerOptions": { // ... your options }, "include": ["src/**/*"], "exclude": ["node_modules"] }

If you don't set the include array setting it defaults to ** if the files setting is not specified, otherwise an empty array [].

Make sure to only exclude the files that you want to filter out. If you have an exclude pattern that matches all of the files in your project, the error occurs.

Most of the time, TypeScript just needs an entry point for your project to be able to compile successfully and solve the error.

I've written a detailed guide on how to exclude a folder from compilation with tsconfig.json.

# Create a tsconfig.json file in your project's root directory

If you don't use TypeScript in your project, but still get the error and a restart of your IDE doesn't help things, you can create a tsconfig.json file in your project's root directory to simply silence the error.

tsconfig.json
{ "compilerOptions": { "allowJs": false, "noEmit": true }, "exclude": ["src/**/*", "your-other-src/**/*"], "files": ["placeholder.ts"] }

And create a placeholder.ts file right next to the tsconfig.json file.

placeholder.ts
export {};

Restart your IDE and the error should be resolved.

The tsconfig.json file from the example looks to exclude all of your source files from compilation and just needs a single file as an entry point (placeholder.js) in the example.

The whole point of this tsconfig.json file is to silence the error in projects that don't use TypeScript.

I wrote a book in which I share everything I know about how to become a better, more efficient programmer.
book cover
You can use the search field on my Home Page to filter through all of my articles.