feat: add support for TypeScript 3.3 (and drop older versions) (#29004)

https://blogs.msdn.microsoft.com/typescript/2019/01/31/announcing-typescript-3-3/

BREAKING CHANGE: TypeScript 3.1 and 3.2 are no longer supported.

Please update your TypeScript version to 3.3

PR Close #29004
This commit is contained in:
Igor Minar
2019-02-02 01:02:16 -08:00
committed by Kara Erickson
parent 9a7f5601fa
commit 75748d6044
21 changed files with 59 additions and 167 deletions

View File

@ -44,6 +44,9 @@ export class GeneratedShimsHostWrapper implements ts.CompilerHost {
if (delegate.directoryExists !== undefined) {
this.directoryExists = (directoryName: string) => delegate.directoryExists !(directoryName);
}
if (delegate.getDirectories !== undefined) {
this.getDirectories = (path: string) => delegate.getDirectories !(path);
}
}
resolveTypeReferenceDirectives?:
@ -84,7 +87,7 @@ export class GeneratedShimsHostWrapper implements ts.CompilerHost {
getCurrentDirectory(): string { return this.delegate.getCurrentDirectory(); }
getDirectories(path: string): string[] { return this.delegate.getDirectories(path); }
getDirectories?: (path: string) => string[];
getCanonicalFileName(fileName: string): string {
return this.delegate.getCanonicalFileName(fileName);

View File

@ -41,6 +41,9 @@ export class SyntheticFilesCompilerHost implements PluginCompilerHost {
this.syntheticFiles.set(generated.fileName, generated);
}
}
if (delegate.getDirectories !== undefined) {
this.getDirectories = (path: string) => delegate.getDirectories !(path);
}
}
fileExists(filePath: string): boolean {
@ -88,7 +91,7 @@ export class SyntheticFilesCompilerHost implements PluginCompilerHost {
getNewLine(): string { return this.delegate.getNewLine(); }
getDirectories(path: string) { return this.delegate.getDirectories(path); }
getDirectories?: (path: string) => string[];
readFile(fileName: string): string|undefined { return this.delegate.readFile(fileName); }

View File

@ -34,6 +34,10 @@ export class TypeCheckProgramHost implements ts.CompilerHost {
// as efficient as possible. To support both of these requirements, all of the program's
// source files are loaded into the cache up front.
program.getSourceFiles().forEach(file => { this.sfCache.set(file.fileName, file); });
if (delegate.getDirectories !== undefined) {
this.getDirectories = (path: string) => delegate.getDirectories !(path);
}
}
getSourceFile(
@ -77,7 +81,7 @@ export class TypeCheckProgramHost implements ts.CompilerHost {
getCurrentDirectory(): string { return this.delegate.getCurrentDirectory(); }
getDirectories(path: string): string[] { return this.delegate.getDirectories(path); }
getDirectories?: (path: string) => string[];
getCanonicalFileName(fileName: string): string {
return this.delegate.getCanonicalFileName(fileName);