diff --git a/packages/compiler-cli/src/ngtsc/util/src/typescript.ts b/packages/compiler-cli/src/ngtsc/util/src/typescript.ts index d672cc651b..a63ded5d28 100644 --- a/packages/compiler-cli/src/ngtsc/util/src/typescript.ts +++ b/packages/compiler-cli/src/ngtsc/util/src/typescript.ts @@ -78,7 +78,12 @@ export function getRootDirs(host: ts.CompilerHost, options: ts.CompilerOptions): } else { rootDirs.push(host.getCurrentDirectory()); } - return rootDirs.map(rootDir => AbsoluteFsPath.fromUnchecked(rootDir)); + + // In Windows the above might not always return posix separated paths + // See: + // https://github.com/Microsoft/TypeScript/blob/3f7357d37f66c842d70d835bc925ec2a873ecfec/src/compiler/sys.ts#L650 + // Also compiler options might be set via an API which doesn't normalize paths + return rootDirs.map(rootDir => AbsoluteFsPath.from(rootDir)); } export function nodeDebugInfo(node: ts.Node): string {