fix(ivy): add missing directoryExists() method to shim CompilerHost (#27470)
The method `ts.CompilerHost.directoryExists` is optional, and was not previously handled by our ts.CompilerHost wrapper for factory and summary shims (GeneratedShimsHostWrapper). TypeScript checks for the existence of this method and silently ignores things like typeRoots if it's not found. This commit adds proper handling of directoryExists() to the shim. A test is also added which verifies typeRoots behavior works when shims are enabled. PR Close #27470
This commit is contained in:

committed by
Igor Minar

parent
345bdd3db0
commit
0d8ab323a7
@ -39,11 +39,16 @@ export class GeneratedShimsHostWrapper implements ts.CompilerHost {
|
||||
(delegate.resolveTypeReferenceDirectives as ts3ResolveTypeReferenceDirectives) !(
|
||||
names, containingFile);
|
||||
}
|
||||
if (delegate.directoryExists !== undefined) {
|
||||
this.directoryExists = (directoryName: string) => delegate.directoryExists !(directoryName);
|
||||
}
|
||||
}
|
||||
|
||||
resolveTypeReferenceDirectives?:
|
||||
(names: string[], containingFile: string) => ts.ResolvedTypeReferenceDirective[];
|
||||
|
||||
directoryExists?: (directoryName: string) => boolean;
|
||||
|
||||
getSourceFile(
|
||||
fileName: string, languageVersion: ts.ScriptTarget,
|
||||
onError?: ((message: string) => void)|undefined,
|
||||
|
Reference in New Issue
Block a user