Skip to content

OverExposureFileSystem

The subset of file-system operations the language-service host needs. Injecting this (rather than always using typescript’s sys) lets tests drive the analyzer against in-memory sources with no real file-system access.

Import:

import type { OverExposureFileSystem } from '@mnaoumov/typescript-dev-toolkit/linters/over-exposure';

Signature:

export interface OverExposureFileSystem

Properties

PropertyTypeDescription
directoryExists(path: string) => booleanChecks whether a directory exists.
fileExists(path: string) => booleanChecks whether a file exists.
getCurrentDirectory() => stringResolves the directory that relative paths are resolved against.
getDirectories(path: string) => string[]Lists the immediate subdirectories of a directory.
readDirectory(path: string, extensions?: readonly string[], exclude?: readonly string[], include?: readonly string[], depth?: number) => string[]Lists the files under a directory, filtered by extension and include/exclude patterns.
readFile(path: string) => string | undefinedReads a file as text.

Links to this page: