How to fix Composite projects may not ask for all files in TypeScript

TypeScriptINTERMEDIATEMEDIUMUpdated Dec 8, 2025· 112 views

This error occurs when a TypeScript composite project tries to use compiler options that are incompatible with composite project configuration. The most common cause is conflicting settings between composite mode and skipLibCheck options.

Quick fix

Fixes TS6059

{
  "compilerOptions": {
    "composite": true,
    "declaration": true,
    "declarationMap": true,
    "sourceMap": true
  }
}
  1. Verify composite configuration
  2. Check include and exclude patterns
  3. Remove or fix skipLibCheck in composite projects
  4. Verify project references are correct
typescript — error
{
"compilerOptions": {
"composite": true,
"declaration": true,
"declarationMap": true,
"sourceMap": true
}
}
Composite projects may not ask for all files

What this error means

TypeScript composite projects are designed to work as part of a monorepo build system, where project references are resolved in a specific order. When you enable the `composite` option in a `tsconfig.json` file, you're telling TypeScript that: 1. This project is part of a larger multi-project setup 2. It should emit `.tsbuildinfo` files for build caching 3. Other projects can reference this project as a dependency The error "Composite projects may not ask for all files" indicates a conflict between what the composite project configuration requires and certain compiler options that would cause TypeScript to process files in ways incompatible with the composite build system. This typically happens when options like `skipLibCheck` are used incorrectly or when the project structure doesn't properly align with composite project constraints.

Typical symptoms

  • Error appears when building a TypeScript monorepo with project references
  • Error occurs after enabling composite: true in tsconfig.json
  • Build fails during tsc --build operations
  • The error message specifically mentions composite projects and file selection
  • Child projects can build independently but fail when referenced by parent projects
  • Error appears inconsistently across different developers or CI environments

Common causes

  1. skipLibCheck option is incompatible with composite project configuration in some TypeScript versions
  2. Project structure doesn't properly define which files belong to the composite project
  3. Include/exclude patterns in tsconfig.json conflict with project references
  4. Using glob patterns or wildcards in rootDirs with composite mode enabled
  5. Mismatched TypeScript versions across referenced projects
  6. Circular project references creating ambiguity about file ownership
  7. Files are included via multiple project references without clear separation

How to fix "Composite projects may not ask for all files"

1Verify composite configuration

First, confirm that composite is explicitly set to true in your tsconfig.json:

json
{
  "compilerOptions": {
    "composite": true,
    "declaration": true,
    "declarationMap": true,
    "sourceMap": true
  }
}

The declaration, declarationMap, and sourceMap options are required for composite projects.

2Check include and exclude patterns

Ensure your include and exclude arrays are explicit and don't conflict with other projects:

json
{
  "include": [
    "src/**/*.ts"
  ],
  "exclude": [
    "node_modules",
    "dist",
    "**/*.test.ts"
  ]
}

Avoid using overly broad patterns like ["src"] which might include unintended files. Use exact paths relative to the project root.

3Remove or fix skipLibCheck in composite projects

If you're using skipLibCheck, verify it's compatible with your composite setup:

json
{
  "compilerOptions": {
    "composite": true,
    "skipLibCheck": true
  }
}

If you still get the error, try removing skipLibCheck for the composite project itself:

json
{
  "compilerOptions": {
    "composite": true
  }
}

You can use skipLibCheck in consumer projects that reference this one, but not in the base composite project.

4Verify project references are correct

Check that references in your tsconfig.json point to valid paths with proper tsconfig.json files:

json
{
  "compilerOptions": {
    "composite": true
  },
  "references": [
    { "path": "../utils" },
    { "path": "../types" }
  ]
}

Each referenced project must:
- Have its own tsconfig.json with composite: true
- Contain a src directory or proper include pattern
- Not include files from parent or sibling projects

5Clean build cache and rebuild

Remove build artifacts and cache, then rebuild using --build:

bash
# Remove all .tsbuildinfo files and dist directories
find . -name "*.tsbuildinfo" -delete
find . -name "dist" -type d -exec rm -rf {} + 2>/dev/null || true

# Rebuild using the composite build system
tsc --build tsconfig.json

# Or rebuild with verbose output to see what's happening
tsc --build tsconfig.json --listFiles
6Check TypeScript version consistency

Ensure all projects use the same TypeScript version:

bash
npm list typescript

All projects should use the same major.minor version:

json
{
  "devDependencies": {
    "typescript": "^5.3.0"
  }
}

If versions differ, update them:

bash
npm install -D typescript@latest

Advanced notes

### Understanding Composite Projects

Composite projects enforce stricter rules than regular TypeScript projects:

1. Separate declaration files: Declaration files (.d.ts) for referenced projects are used instead of scanning source files
2. No circular references: Projects cannot reference each other circularly
3. Explicit boundaries: Each project must have clear include/exclude boundaries
4. Build order matters: tsc --build determines and respects dependency order

### skipLibCheck in Monorepos

The skipLibCheck option was designed for single-project setups to speed up builds. In composite projects:

- In composite project root: May cause conflicts with the build system's file resolution
- In consumer projects: Generally safe to use to speed up builds
- Alternative: Use skipDefaultLibCheck instead for better control

### Debugging File Inclusion

If you're unsure what files are being included, use diagnostic flags:

bash
tsc --build --listFilesOnly
tsc --build --diagnostics

This shows exactly which files TypeScript is processing and how long it takes.

### Monorepo Structure Best Practice

bash
my-monorepo/
├── tsconfig.json              # Root tsconfig (references field)
├── packages/
│   ├── utils/
│   │   ├── tsconfig.json      # composite: true, include: ["src"]
│   │   ├── src/
│   │   │   └── index.ts
│   │   └── dist/
│   ├── types/
│   │   ├── tsconfig.json
│   │   ├── src/
│   │   └── dist/
│   └── app/
│       ├── tsconfig.json
│       ├── src/
│       └── dist/

Each package's tsconfig should only include its own src directory.

Frequently asked questions

What does "TS6059" mean?
TypeScript composite projects are designed to work as part of a monorepo build system, where project references are resolved in a specific order. json file, you're telling TypeScript that: 1. This project is part of a larger multi-project setup 2.
How do I fix "TS6059"?
This error occurs when a TypeScript composite project tries to use compiler options that are incompatible with composite project configuration. The most common cause is conflicting settings between composite mode and skipLibCheck options.
What causes "TS6059"?
skipLibCheck option is incompatible with composite project configuration in some TypeScript versions Project structure doesn't properly define which files belong to the composite project Include/exclude patterns in tsconfig.json conflict with project references
Is the "TS6059" error serious?
It is a medium-severity error — more of a blocker than a risk. The steps above resolve it.

Official resources & further reading