diff --git a/packages/compiler-cli/src/ngtsc/util/src/typescript.ts b/packages/compiler-cli/src/ngtsc/util/src/typescript.ts index f8ca1fb619..63af2e8206 100644 --- a/packages/compiler-cli/src/ngtsc/util/src/typescript.ts +++ b/packages/compiler-cli/src/ngtsc/util/src/typescript.ts @@ -92,7 +92,9 @@ export function isExported(node: DeclarationNode): boolean { topLevel.modifiers.some(modifier => modifier.kind === ts.SyntaxKind.ExportKeyword); } -export function getRootDirs(host: ts.CompilerHost, options: ts.CompilerOptions): AbsoluteFsPath[] { +export function getRootDirs( + host: Pick, + options: ts.CompilerOptions): AbsoluteFsPath[] { const rootDirs: string[] = []; if (options.rootDirs !== undefined) { rootDirs.push(...options.rootDirs); diff --git a/packages/language-service/ivy/BUILD.bazel b/packages/language-service/ivy/BUILD.bazel index 044974cee2..37b67f6c39 100644 --- a/packages/language-service/ivy/BUILD.bazel +++ b/packages/language-service/ivy/BUILD.bazel @@ -18,6 +18,7 @@ ts_library( "//packages/compiler-cli/src/ngtsc/shims", "//packages/compiler-cli/src/ngtsc/typecheck", "//packages/compiler-cli/src/ngtsc/typecheck/api", + "//packages/compiler-cli/src/ngtsc/util", "@npm//@types/node", "@npm//typescript", ], diff --git a/packages/language-service/ivy/adapters.ts b/packages/language-service/ivy/adapters.ts index c95d326688..bd02eaa562 100644 --- a/packages/language-service/ivy/adapters.ts +++ b/packages/language-service/ivy/adapters.ts @@ -10,8 +10,9 @@ import {ConfigurationHost} from '@angular/compiler-cli'; import {NgCompilerAdapter} from '@angular/compiler-cli/src/ngtsc/core/api'; -import {absoluteFrom, AbsoluteFsPath, FileStats, PathSegment, PathString} from '@angular/compiler-cli/src/ngtsc/file_system'; +import {AbsoluteFsPath, FileStats, PathSegment, PathString} from '@angular/compiler-cli/src/ngtsc/file_system'; import {isShim} from '@angular/compiler-cli/src/ngtsc/shims'; +import {getRootDirs} from '@angular/compiler-cli/src/ngtsc/util/src/typescript'; import * as p from 'path'; import * as ts from 'typescript/lib/tsserverlibrary'; @@ -27,7 +28,7 @@ export class LanguageServiceAdapter implements NgCompilerAdapter { private readonly templateVersion = new Map(); constructor(private readonly project: ts.server.Project) { - this.rootDirs = project.getCompilationSettings().rootDirs?.map(absoluteFrom) || []; + this.rootDirs = getRootDirs(this, project.getCompilationSettings()); } isShim(sf: ts.SourceFile): boolean {