From a331d695dbb1cd52492ab29ef86b72cc8e150e74 Mon Sep 17 00:00:00 2001 From: Lev Chelyadinov Date: Thu, 30 May 2024 17:52:55 +0200 Subject: [PATCH] Fix referencing of TypeScript https://github.com/microsoft/TypeScript/issues/54018 --- src/resolve-import.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/resolve-import.ts b/src/resolve-import.ts index c80bfd2..6d1e501 100644 --- a/src/resolve-import.ts +++ b/src/resolve-import.ts @@ -1,4 +1,5 @@ -import { resolveModuleName, sys, type CompilerOptions } from "typescript"; +import ts from "typescript"; +import type { CompilerOptions } from "typescript"; /** * Given a file name, an imported path, and a TSConfig object, produce a path to the imported file, relative to TypeScript's `baseUrl`. @@ -40,8 +41,8 @@ export function resolveImport( directoryExists?: (path: string) => boolean, ): string | null { return ( - resolveModuleName(importedPath, importerPath, tsCompilerOptions, { - ...sys, + ts.resolveModuleName(importedPath, importerPath, tsCompilerOptions, { + ...ts.sys, fileExists, directoryExists, }).resolvedModule?.resolvedFileName ?? null