From 6d7230dbb83e964aefcd0642c1f3723ad3d1c0ff Mon Sep 17 00:00:00 2001 From: Andrew Bradley Date: Sat, 19 Feb 2022 00:13:41 -0500 Subject: [PATCH] Fix --- src/index.ts | 2 +- src/resolver-functions.ts | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/index.ts b/src/index.ts index 0ffeea3fc..0544b2d98 100644 --- a/src/index.ts +++ b/src/index.ts @@ -605,7 +605,7 @@ export function create(rawOptions: CreateOptions = {}): Service { const projectLocalResolveHelper = createProjectLocalResolveHelper(relativeToPath); const compiler = projectLocalResolveHelper(name || 'typescript', true); - const ts: typeof _ts = attemptRequireWithV8CompileCache(require, compiler); + const ts: TSCommon = attemptRequireWithV8CompileCache(require, compiler); return { compiler, ts, projectLocalResolveHelper }; } diff --git a/src/resolver-functions.ts b/src/resolver-functions.ts index 3e8d7ffff..ecb5d98e2 100644 --- a/src/resolver-functions.ts +++ b/src/resolver-functions.ts @@ -7,7 +7,7 @@ import type { ProjectLocalResolveHelper } from './util'; * In a factory because these are shared across both CompilerHost and LanguageService codepaths */ export function createResolverFunctions(kwargs: { - ts: TSCommon & TSInternal; + ts: TSCommon; host: TSCommon.ModuleResolutionHost; cwd: string; getCanonicalFileName: (filename: string) => string; @@ -140,7 +140,10 @@ export function createResolverFunctions(kwargs: { const nameIsString = typeof typeDirectiveName === 'string'; const mode = nameIsString ? undefined - : ts.getModeForFileReference!(typeDirectiveName, containingFileMode); + : (ts as any as TSInternal).getModeForFileReference!( + typeDirectiveName, + containingFileMode + ); const strName = nameIsString ? typeDirectiveName : typeDirectiveName.fileName.toLowerCase();