{"record":{"id":"ef79d9028148e66b","repo":"angular/components","slug":"unable-to-read-directory-in-virtual-file-system-ho","errorCode":null,"errorMessage":"Unable to read directory in virtual file system host. This means that TypeScript changed its file matching internals.\n\nPlease consider downgrading your TypeScript version, and report an issue in the Angular Components repository.","messagePattern":"Unable to read directory in virtual file system host\\. This means that TypeScript changed its file matching internals\\.\n\nPlease consider downgrading your TypeScript version, and report an issue in the Angular Components repository\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cdk/schematics/update-tool/utils/virtual-host.ts","lineNumber":72,"sourceCode":"  readFile(path: string): string | undefined {\n    const content = this._fileSystem.read(this._fileSystem.resolve(path));\n    if (content === null) {\n      return undefined;\n    }\n    // Strip BOM as otherwise TSC methods (e.g. \"getWidth\") will return an offset which\n    // which breaks the CLI UpdateRecorder. https://github.com/angular/angular/pull/30719\n    return content.replace(/^\\uFEFF/, '');\n  }\n\n  readDirectory(\n    rootDir: string,\n    extensions: string[],\n    excludes: string[] | undefined,\n    includes: string[],\n    depth?: number,\n  ): string[] {\n    if (ts.matchFiles === undefined) {\n      throw Error(\n        'Unable to read directory in virtual file system host. This means that ' +\n          'TypeScript changed its file matching internals.\\n\\nPlease consider downgrading your ' +\n          'TypeScript version, and report an issue in the Angular Components repository.',\n      );\n    }\n    return ts.matchFiles(\n      rootDir,\n      extensions,\n      extensions,\n      includes,\n      this.useCaseSensitiveFileNames,\n      '/',\n      depth,\n      p => this._getFileSystemEntries(p),\n      p => this._fileSystem.resolve(p),\n      p => this._fileSystem.directoryExists(this._fileSystem.resolve(p)),\n    );\n  }","sourceCodeStart":54,"sourceCodeEnd":90,"githubUrl":"https://github.com/angular/components/blob/0411926e7d8ae06b32236ec1048a888cfad5abf2/src/cdk/schematics/update-tool/utils/virtual-host.ts#L54-L90","documentation":"Internal CDK schematics error thrown by the virtual file system host used by the ng-update tooling. The schematic relies on TypeScript's internal ts.matchFiles API to emulate directory reads; if TypeScript no longer exposes matchFiles, the tool cannot work and asks users to downgrade TypeScript and report the issue.","triggerScenarios":"Running ng update / an Angular Components migration schematic with a TypeScript version whose internal API no longer includes ts.matchFiles (TypeScript changed its file-matching internals).","commonSituations":"Upgrading TypeScript to a version incompatible with the schematics package; running migrations in a repo with a much newer TypeScript than the Angular CDK version supports; using a custom TypeScript build/fork without matchFiles.","solutions":["Downgrade TypeScript to a version compatible with your @angular/cdk version (see the CDK's peer dependency on typescript)","Update @angular/cdk / @angular/cli to a newer release that supports your TypeScript version","Pin the typescript version in package.json (e.g. \"typescript\": \"~5.4.0\") while running the migration","Report the issue on the Angular Components repository so the tooling can be adapted"],"exampleFix":"// before (package.json)\n\"devDependencies\": { \"typescript\": \"^5.9.0\" }\n// after (package.json)\n\"devDependencies\": { \"typescript\": \"~5.4.0\" }","handlingStrategy":"fallback","validationCode":"import * as ts from 'typescript';\nif (typeof (ts as any).matchFiles !== 'function') {\n  throw new Error(`TypeScript ${ts.version} is incompatible with @angular/cdk migration tooling; downgrade TypeScript.`);\n}","typeGuard":"function supportsMatchFiles(ts: typeof import('typescript')): boolean {\n  return typeof (ts as unknown as { matchFiles?: unknown }).matchFiles === 'function';\n}","tryCatchPattern":"try {\n  await runMigration(context);\n} catch (e) {\n  if (e instanceof Error && e.message.includes('virtual file system host')) {\n    console.error('TypeScript version incompatible with CDK schematics. Pin typescript to the version in @angular/cdk peerDependencies.');\n  } else {\n    throw e;\n  }\n}","preventionTips":["Keep the typescript version within the peer dependency range of @angular/cdk","Pin (not range) the typescript version while running ng update migrations","Run migrations before major TypeScript upgrades","Check the Angular Components repo release notes for supported TypeScript versions"],"tags":["angular","cdk","schematics","typescript","tooling"],"backgroundTag":"typescript-internals-incompatible","analyzedSha":"0411926e7d8ae06b32236ec1048a888cfad5abf2","analyzedAt":"2026-08-31T11:58:23.400Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}