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();