diff --git a/src/parse-tsconfig/index.ts b/src/parse-tsconfig/index.ts index cdd419f..32b08ff 100644 --- a/src/parse-tsconfig/index.ts +++ b/src/parse-tsconfig/index.ts @@ -11,7 +11,7 @@ const resolveExtends = ( extendsPath: string, fromDirectoryPath: string, circularExtendsTracker: Set, - cache?: Cache, + cache?: Cache, ) => { const resolvedExtendsPath = resolveExtendsPath( extendsPath, @@ -79,7 +79,7 @@ const resolveExtends = ( const _parseTsconfig = ( tsconfigPath: string, - cache?: Cache, + cache?: Cache, circularExtendsTracker = new Set(), ): TsConfigJsonResolved => { let realTsconfigPath: string; @@ -213,5 +213,5 @@ const _parseTsconfig = ( export const parseTsconfig = ( tsconfigPath: string, - cache: Cache = new Map(), + cache: Cache = new Map(), ): TsConfigJsonResolved => _parseTsconfig(tsconfigPath, cache); diff --git a/src/parse-tsconfig/resolve-extends-path.ts b/src/parse-tsconfig/resolve-extends-path.ts index 945bded..b59939d 100644 --- a/src/parse-tsconfig/resolve-extends-path.ts +++ b/src/parse-tsconfig/resolve-extends-path.ts @@ -18,7 +18,7 @@ const resolveFromPackageJsonPath = ( packageJsonPath: string, subpath: string, ignoreExports?: boolean, - cache?: Cache, + cache?: Cache, ) => { const cacheKey = `resolveFromPackageJsonPath:${packageJsonPath}:${subpath}:${ignoreExports}`; if (cache?.has(cacheKey)) { @@ -67,7 +67,7 @@ const TS_CONFIG_JSON = 'tsconfig.json'; export const resolveExtendsPath = ( requestedPath: string, directoryPath: string, - cache?: Cache, + cache?: Cache, ) => { let filePath = requestedPath; diff --git a/src/types.ts b/src/types.ts index 81b0d89..c165a0e 100644 --- a/src/types.ts +++ b/src/types.ts @@ -18,4 +18,4 @@ export type TsConfigResult = { }; // eslint-disable-next-line @typescript-eslint/no-explicit-any -export type Cache = Map; +export type Cache = Map; diff --git a/src/utils/fs-cached.ts b/src/utils/fs-cached.ts index 470191c..43ae89c 100644 --- a/src/utils/fs-cached.ts +++ b/src/utils/fs-cached.ts @@ -16,12 +16,14 @@ const cacheFs = ( name: MethodName, ) => { const method = fs[name]; + type FsReturnType = ReturnType; + return ( cache?: Cache, ...args: any[] - ): ReturnType => { + ): FsReturnType => { const cacheKey = `${name}:${args.join(':')}`; - let result = cache?.get(cacheKey); + let result = cache?.get(cacheKey) as FsReturnType; if (result === undefined) { result = Reflect.apply(method, fs, args);