The tsc command failed because the TypeScript compiler couldn’t find any files to process based on your tsconfig.json configuration.

This error, TS18003: No inputs found in tsconfig, typically means that the include, files, or exclude properties in your tsconfig.json are configured in such a way that no TypeScript files (.ts, .tsx) are being picked up for compilation. It’s a common stumbling block when setting up a new project or modifying an existing tsconfig.json.

Here are the most common reasons and how to fix them:

1. Incorrect include Pattern

The include property specifies an array of glob patterns that the compiler should include. If these patterns don’t match any files, you’ll see this error.

Diagnosis: Check your tsconfig.json for the include property. For example, if you have:

{
  "compilerOptions": {
    // ... other options
  },
  "include": [
    "src/**/*.ts"
  ]
}

And your TypeScript files are actually in a directory named app instead of src, or if there are no .ts files directly under src (e.g., they are all in subdirectories), the pattern might be too restrictive.

Fix: Adjust the include pattern to accurately reflect your project structure. If your files are in src/components/MyComponent.ts and src/utils/helpers.ts, then "src/**/*.ts" is correct. If they are in app/main.ts, change it to "app/**/*.ts". If you want to include files from the root directory as well, you might use:

"include": [
  "src/**/*.ts",
  "*.ts"
]

Or, a more general pattern that covers most common structures:

"include": [
  "**/*.ts"
]

This tells the compiler to look for .ts files in any subdirectory from the directory where tsconfig.json resides.

Why it works: The include property is the primary way tsc knows what to compile. By ensuring the glob patterns correctly point to your actual .ts and .tsx files, you provide the compiler with the necessary input.

2. Missing or Incorrect files Property

The files property is an explicit list of files to include. If you use files and it’s empty or doesn’t list any of your .ts files, tsc won’t find anything. The include property is ignored if files is present.

Diagnosis: Look for a files property in your tsconfig.json. If it’s present, check if it contains valid paths to your TypeScript files. An empty files array like [] will cause this error.

Fix: Either remove the files property entirely if you intend to use include (which is more common for managing larger projects), or populate it with the correct paths to your TypeScript files. For example:

{
  "compilerOptions": {
    // ...
  },
  "files": [
    "src/index.ts",
    "src/types.d.ts"
  ]
}

If you intended to use include but accidentally added an empty files array, simply remove the files property.

Why it works: When files is present, tsc only considers the files explicitly listed. Correcting this list or removing the property allows tsc to revert to using include or its default file discovery.

3. Overly Broad exclude Pattern

The exclude property specifies files or patterns that should be ignored, even if they are matched by include. An exclude pattern that’s too broad can unintentionally exclude all your source files.

Diagnosis: Examine the exclude property in your tsconfig.json. The default exclude is ["node_modules", "bower_components", "jspm_packages", "**/*.spec.js"]. If you’ve added patterns that are too aggressive, they might be removing your source files. For instance, if you have:

{
  "compilerOptions": {
    // ...
  },
  "include": [
    "src/**/*.ts"
  ],
  "exclude": [
    "**/*" // This excludes everything!
  ]
}

Fix: Refine your exclude patterns. Generally, you only need to exclude build output directories, test files you don’t want compiled, or specific third-party libraries that might be mistakenly included by a broad include. A common and safe exclude is:

"exclude": [
  "node_modules",
  "**/*.spec.ts", // Exclude test files if they are separate
  "dist", // Exclude build output directory
  "build"
]

Ensure that your exclude patterns do not overlap with your intended source files in a way that removes them.

Why it works: exclude acts as a filter after include has identified potential files. By making the exclude less restrictive, you allow files that match include to pass through the filter.

4. tsconfig.json Not in Project Root or Incorrectly Referenced

The tsc command, by default, looks for tsconfig.json in the current directory and its parent directories. If you’re running tsc from a subdirectory or if your tsconfig.json is in an unexpected location, it might not be found or might be interpreted with the wrong base path.

Diagnosis: Verify the directory from which you are running the tsc command. Ensure that tsconfig.json is present in that directory or a parent directory. If you’re invoking tsc with a specific path to the config file (e.g., tsc -p ./config/tsconfig.json), ensure that path is correct relative to your current working directory.

Fix: Navigate to your project’s root directory (where tsconfig.json is typically located) and run tsc from there. If you must run tsc from a different location, use the -p flag to explicitly point to the correct tsconfig.json file:

tsc -p /path/to/your/project/tsconfig.json

Or, if running from a subdirectory:

tsc -p ../tsconfig.json

Why it works: The tsc command needs to find and parse the tsconfig.json file correctly. Specifying the correct path ensures that tsc uses the intended configuration, and its relative paths (for include, files, exclude, outDir, etc.) are resolved from the correct base directory.

5. No TypeScript Files in the Project at All

This is the most straightforward but sometimes overlooked cause: you might not have any .ts or .tsx files in your project that match the include or files patterns.

Diagnosis: Perform a manual file search in your project’s directory structure. Use your file explorer or command line to look for files with .ts or .tsx extensions. If you can’t find any, or if they are in a location not covered by your tsconfig.json’s include or files properties, this is the issue.

Fix: Create at least one TypeScript file (e.g., src/index.ts) and ensure it’s included by your tsconfig.json’s include or files property. If you’re just starting and haven’t added any .ts files yet, this is expected.

Why it works: The compiler needs actual source files to operate on. Adding a .ts file that is recognized by the configuration provides the compiler with the necessary input.

6. filesGlob Property Misconfiguration (Common in Older/Certain Framework Setups)

Some build tools or older configurations might use a filesGlob property in tsconfig.json or a related configuration file, which tsc itself doesn’t directly process but might influence what tsc is told to compile. If this is misconfigured, it can lead to tsc receiving an empty list of files.

Diagnosis: This is less common with direct tsc usage but can occur in frameworks like Angular or if you’re using specific task runners. Check if filesGlob is present and if its patterns are correct.

Fix: If you are using a tool that respects filesGlob, ensure its patterns are correct. If you are using tsc directly, you should rely on include and files. If you see filesGlob in your tsconfig.json and aren’t sure why it’s there, it’s often safe to remove it if you are using include.

Why it works: This ensures that the file discovery mechanism used by your specific build setup correctly identifies TypeScript files before passing them to the tsc compiler.

After fixing these issues, the next error you might encounter is related to compiler options (e.g., TSConfig Error: Unknown compiler option 'foo') or specific syntax errors within your TypeScript files if they weren’t previously parsed.

Want structured learning?

Take the full Typescript course →