diff --git a/src/compiler/program.ts b/src/compiler/program.ts index e764e20f29f..56aaf75f667 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -98,9 +98,11 @@ module ts { getSourceFiles: () => files, getCompilerOptions: () => options, getCompilerHost: () => host, - getDiagnostics: getDiagnostics, - getGlobalDiagnostics: getGlobalDiagnostics, - getDeclarationDiagnostics: getDeclarationDiagnostics, + getDiagnostics, + getGlobalDiagnostics, + getTypeCheckerDiagnostics, + getTypeCheckerGlobalDiagnostics, + getDeclarationDiagnostics, getTypeChecker, getCommonSourceDirectory: () => commonSourceDirectory, emitFiles: invokeEmitter, @@ -115,7 +117,7 @@ module ts { function isEmitBlocked(sourceFile?: SourceFile): boolean { if (options.noEmitOnError) { - return getDiagnostics(sourceFile).length !== 0 || getDiagnosticsProducingTypeChecker().getDiagnostics(sourceFile).length !== 0; + return getDiagnostics(sourceFile).length !== 0 || getTypeCheckerDiagnostics(sourceFile).length !== 0; } return false; @@ -151,6 +153,14 @@ module ts { return hasProperty(filesByName, fileName) ? filesByName[fileName] : undefined; } + function getTypeCheckerDiagnostics(sourceFile?: SourceFile): Diagnostic[] { + return getDiagnosticsProducingTypeChecker().getDiagnostics(sourceFile); + } + + function getTypeCheckerGlobalDiagnostics(): Diagnostic[] { + return getDiagnosticsProducingTypeChecker().getGlobalDiagnostics(); + } + function getDiagnostics(sourceFile?: SourceFile): Diagnostic[] { return sourceFile ? filter(errors, e => e.file === sourceFile) : errors; } diff --git a/src/compiler/types.ts b/src/compiler/types.ts index ff71bd8a0a0..1f139b093c4 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -931,6 +931,10 @@ module ts { getSourceFiles(): SourceFile[]; getCompilerHost(): CompilerHost; + // These will merge with the below diagnostics function in a followup checkin. + getTypeCheckerDiagnostics(sourceFile?: SourceFile): Diagnostic[]; + getTypeCheckerGlobalDiagnostics(): Diagnostic[]; + getDiagnostics(sourceFile?: SourceFile): Diagnostic[]; getGlobalDiagnostics(): Diagnostic[]; getDeclarationDiagnostics(sourceFile: SourceFile): Diagnostic[]; @@ -997,8 +1001,6 @@ module ts { export interface TypeChecker { getEmitResolver(): EmitResolver; - getDiagnostics(sourceFile?: SourceFile): Diagnostic[]; - getGlobalDiagnostics(): Diagnostic[]; getTypeOfSymbolAtLocation(symbol: Symbol, node: Node): Type; getDeclaredTypeOfSymbol(symbol: Symbol): Type; getPropertiesOfType(type: Type): Symbol[]; @@ -1028,6 +1030,10 @@ module ts { isValidPropertyAccess(node: PropertyAccessExpression | QualifiedName, propertyName: string): boolean; getAliasedSymbol(symbol: Symbol): Symbol; + // Should not be called directly. Should only be accessed through the Program instance. + /* @internal */ getDiagnostics(sourceFile?: SourceFile): Diagnostic[]; + /* @internal */ getGlobalDiagnostics(): Diagnostic[]; + /* @internal */ getNodeCount(): number; /* @internal */ getIdentifierCount(): number; /* @internal */ getSymbolCount(): number; diff --git a/src/services/services.ts b/src/services/services.ts index 6a2040543ba..b58376f2c1e 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -2184,13 +2184,12 @@ module ts { fileName = normalizeSlashes(fileName) var compilerOptions = program.getCompilerOptions(); - var checker = getDiagnosticsProducingTypeChecker(); var targetSourceFile = getValidSourceFile(fileName); // Only perform the action per file regardless of '-out' flag as LanguageServiceHost is expected to call this function per file. // Therefore only get diagnostics for given file. - var allDiagnostics = checker.getDiagnostics(targetSourceFile); + var allDiagnostics = program.getTypeCheckerDiagnostics(targetSourceFile); if (compilerOptions.declaration) { // If '-d' is enabled, check for emitter error. One example of emitter error is export class implements non-export interface allDiagnostics = allDiagnostics.concat(program.getDeclarationDiagnostics(targetSourceFile)); diff --git a/tests/baselines/reference/APISample_compile.js b/tests/baselines/reference/APISample_compile.js index 4131e78284d..9033b832415 100644 --- a/tests/baselines/reference/APISample_compile.js +++ b/tests/baselines/reference/APISample_compile.js @@ -16,11 +16,10 @@ import ts = require("typescript"); export function compile(fileNames: string[], options: ts.CompilerOptions): void { var host = ts.createCompilerHost(options); var program = ts.createProgram(fileNames, options, host); - var checker = ts.createTypeChecker(program, /*produceDiagnostics*/ true); var result = program.emitFiles(); var allDiagnostics = program.getDiagnostics() - .concat(checker.getDiagnostics()) + .concat(program.getTypeCheckerDiagnostics()) .concat(result.diagnostics); allDiagnostics.forEach(diagnostic => { @@ -741,6 +740,8 @@ declare module "typescript" { interface Program extends ScriptReferenceHost { getSourceFiles(): SourceFile[]; getCompilerHost(): CompilerHost; + getTypeCheckerDiagnostics(sourceFile?: SourceFile): Diagnostic[]; + getTypeCheckerGlobalDiagnostics(): Diagnostic[]; getDiagnostics(sourceFile?: SourceFile): Diagnostic[]; getGlobalDiagnostics(): Diagnostic[]; getDeclarationDiagnostics(sourceFile: SourceFile): Diagnostic[]; @@ -789,8 +790,6 @@ declare module "typescript" { } interface TypeChecker { getEmitResolver(): EmitResolver; - getDiagnostics(sourceFile?: SourceFile): Diagnostic[]; - getGlobalDiagnostics(): Diagnostic[]; getTypeOfSymbolAtLocation(symbol: Symbol, node: Node): Type; getDeclaredTypeOfSymbol(symbol: Symbol): Type; getPropertiesOfType(type: Type): Symbol[]; @@ -1917,9 +1916,8 @@ var ts = require("typescript"); function compile(fileNames, options) { var host = ts.createCompilerHost(options); var program = ts.createProgram(fileNames, options, host); - var checker = ts.createTypeChecker(program, true); var result = program.emitFiles(); - var allDiagnostics = program.getDiagnostics().concat(checker.getDiagnostics()).concat(result.diagnostics); + var allDiagnostics = program.getDiagnostics().concat(program.getTypeCheckerDiagnostics()).concat(result.diagnostics); allDiagnostics.forEach(function (diagnostic) { var lineChar = diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start); console.log(diagnostic.file.fileName + " (" + lineChar.line + "," + lineChar.character + "): " + diagnostic.messageText); diff --git a/tests/baselines/reference/APISample_compile.types b/tests/baselines/reference/APISample_compile.types index 2b887bd94ab..744ca08b874 100644 --- a/tests/baselines/reference/APISample_compile.types +++ b/tests/baselines/reference/APISample_compile.types @@ -40,14 +40,6 @@ export function compile(fileNames: string[], options: ts.CompilerOptions): void >options : ts.CompilerOptions >host : ts.CompilerHost - var checker = ts.createTypeChecker(program, /*produceDiagnostics*/ true); ->checker : ts.TypeChecker ->ts.createTypeChecker(program, /*produceDiagnostics*/ true) : ts.TypeChecker ->ts.createTypeChecker : (host: ts.TypeCheckerHost, produceDiagnostics: boolean) => ts.TypeChecker ->ts : typeof ts ->createTypeChecker : (host: ts.TypeCheckerHost, produceDiagnostics: boolean) => ts.TypeChecker ->program : ts.Program - var result = program.emitFiles(); >result : ts.EmitResult >program.emitFiles() : ts.EmitResult @@ -57,21 +49,21 @@ export function compile(fileNames: string[], options: ts.CompilerOptions): void var allDiagnostics = program.getDiagnostics() >allDiagnostics : ts.Diagnostic[] ->program.getDiagnostics() .concat(checker.getDiagnostics()) .concat(result.diagnostics) : ts.Diagnostic[] ->program.getDiagnostics() .concat(checker.getDiagnostics()) .concat : { (...items: U[]): ts.Diagnostic[]; (...items: ts.Diagnostic[]): ts.Diagnostic[]; } ->program.getDiagnostics() .concat(checker.getDiagnostics()) : ts.Diagnostic[] +>program.getDiagnostics() .concat(program.getTypeCheckerDiagnostics()) .concat(result.diagnostics) : ts.Diagnostic[] +>program.getDiagnostics() .concat(program.getTypeCheckerDiagnostics()) .concat : { (...items: U[]): ts.Diagnostic[]; (...items: ts.Diagnostic[]): ts.Diagnostic[]; } +>program.getDiagnostics() .concat(program.getTypeCheckerDiagnostics()) : ts.Diagnostic[] >program.getDiagnostics() .concat : { (...items: U[]): ts.Diagnostic[]; (...items: ts.Diagnostic[]): ts.Diagnostic[]; } >program.getDiagnostics() : ts.Diagnostic[] >program.getDiagnostics : (sourceFile?: ts.SourceFile) => ts.Diagnostic[] >program : ts.Program >getDiagnostics : (sourceFile?: ts.SourceFile) => ts.Diagnostic[] - .concat(checker.getDiagnostics()) + .concat(program.getTypeCheckerDiagnostics()) >concat : { (...items: U[]): ts.Diagnostic[]; (...items: ts.Diagnostic[]): ts.Diagnostic[]; } ->checker.getDiagnostics() : ts.Diagnostic[] ->checker.getDiagnostics : (sourceFile?: ts.SourceFile) => ts.Diagnostic[] ->checker : ts.TypeChecker ->getDiagnostics : (sourceFile?: ts.SourceFile) => ts.Diagnostic[] +>program.getTypeCheckerDiagnostics() : ts.Diagnostic[] +>program.getTypeCheckerDiagnostics : (sourceFile?: ts.SourceFile) => ts.Diagnostic[] +>program : ts.Program +>getTypeCheckerDiagnostics : (sourceFile?: ts.SourceFile) => ts.Diagnostic[] .concat(result.diagnostics); >concat : { (...items: U[]): ts.Diagnostic[]; (...items: ts.Diagnostic[]): ts.Diagnostic[]; } @@ -2261,6 +2253,16 @@ declare module "typescript" { >getCompilerHost : () => CompilerHost >CompilerHost : CompilerHost + getTypeCheckerDiagnostics(sourceFile?: SourceFile): Diagnostic[]; +>getTypeCheckerDiagnostics : (sourceFile?: SourceFile) => Diagnostic[] +>sourceFile : SourceFile +>SourceFile : SourceFile +>Diagnostic : Diagnostic + + getTypeCheckerGlobalDiagnostics(): Diagnostic[]; +>getTypeCheckerGlobalDiagnostics : () => Diagnostic[] +>Diagnostic : Diagnostic + getDiagnostics(sourceFile?: SourceFile): Diagnostic[]; >getDiagnostics : (sourceFile?: SourceFile) => Diagnostic[] >sourceFile : SourceFile @@ -2411,16 +2413,6 @@ declare module "typescript" { >getEmitResolver : () => EmitResolver >EmitResolver : EmitResolver - getDiagnostics(sourceFile?: SourceFile): Diagnostic[]; ->getDiagnostics : (sourceFile?: SourceFile) => Diagnostic[] ->sourceFile : SourceFile ->SourceFile : SourceFile ->Diagnostic : Diagnostic - - getGlobalDiagnostics(): Diagnostic[]; ->getGlobalDiagnostics : () => Diagnostic[] ->Diagnostic : Diagnostic - getTypeOfSymbolAtLocation(symbol: Symbol, node: Node): Type; >getTypeOfSymbolAtLocation : (symbol: Symbol, node: Node) => Type >symbol : Symbol diff --git a/tests/baselines/reference/APISample_linter.js b/tests/baselines/reference/APISample_linter.js index d850585ea37..49519af6f8e 100644 --- a/tests/baselines/reference/APISample_linter.js +++ b/tests/baselines/reference/APISample_linter.js @@ -770,6 +770,8 @@ declare module "typescript" { interface Program extends ScriptReferenceHost { getSourceFiles(): SourceFile[]; getCompilerHost(): CompilerHost; + getTypeCheckerDiagnostics(sourceFile?: SourceFile): Diagnostic[]; + getTypeCheckerGlobalDiagnostics(): Diagnostic[]; getDiagnostics(sourceFile?: SourceFile): Diagnostic[]; getGlobalDiagnostics(): Diagnostic[]; getDeclarationDiagnostics(sourceFile: SourceFile): Diagnostic[]; @@ -818,8 +820,6 @@ declare module "typescript" { } interface TypeChecker { getEmitResolver(): EmitResolver; - getDiagnostics(sourceFile?: SourceFile): Diagnostic[]; - getGlobalDiagnostics(): Diagnostic[]; getTypeOfSymbolAtLocation(symbol: Symbol, node: Node): Type; getDeclaredTypeOfSymbol(symbol: Symbol): Type; getPropertiesOfType(type: Type): Symbol[]; diff --git a/tests/baselines/reference/APISample_linter.types b/tests/baselines/reference/APISample_linter.types index f84338d9d1c..9d5a62f9c66 100644 --- a/tests/baselines/reference/APISample_linter.types +++ b/tests/baselines/reference/APISample_linter.types @@ -2391,6 +2391,16 @@ declare module "typescript" { >getCompilerHost : () => CompilerHost >CompilerHost : CompilerHost + getTypeCheckerDiagnostics(sourceFile?: SourceFile): Diagnostic[]; +>getTypeCheckerDiagnostics : (sourceFile?: SourceFile) => Diagnostic[] +>sourceFile : SourceFile +>SourceFile : SourceFile +>Diagnostic : Diagnostic + + getTypeCheckerGlobalDiagnostics(): Diagnostic[]; +>getTypeCheckerGlobalDiagnostics : () => Diagnostic[] +>Diagnostic : Diagnostic + getDiagnostics(sourceFile?: SourceFile): Diagnostic[]; >getDiagnostics : (sourceFile?: SourceFile) => Diagnostic[] >sourceFile : SourceFile @@ -2541,16 +2551,6 @@ declare module "typescript" { >getEmitResolver : () => EmitResolver >EmitResolver : EmitResolver - getDiagnostics(sourceFile?: SourceFile): Diagnostic[]; ->getDiagnostics : (sourceFile?: SourceFile) => Diagnostic[] ->sourceFile : SourceFile ->SourceFile : SourceFile ->Diagnostic : Diagnostic - - getGlobalDiagnostics(): Diagnostic[]; ->getGlobalDiagnostics : () => Diagnostic[] ->Diagnostic : Diagnostic - getTypeOfSymbolAtLocation(symbol: Symbol, node: Node): Type; >getTypeOfSymbolAtLocation : (symbol: Symbol, node: Node) => Type >symbol : Symbol diff --git a/tests/baselines/reference/APISample_transform.js b/tests/baselines/reference/APISample_transform.js index 4c86119f6a0..ec48720eb9c 100644 --- a/tests/baselines/reference/APISample_transform.js +++ b/tests/baselines/reference/APISample_transform.js @@ -49,8 +49,7 @@ function transform(contents: string, compilerOptions: ts.CompilerOptions = {}) { // Do not generate code in the presence of early errors if (!errors.length) { // Type check and get semantic errors - var checker = program.getTypeChecker(true); - errors = checker.getDiagnostics(); + errors = program.getTypeCheckerDiagnostics(); // Generate output program.emitFiles(); } @@ -771,6 +770,8 @@ declare module "typescript" { interface Program extends ScriptReferenceHost { getSourceFiles(): SourceFile[]; getCompilerHost(): CompilerHost; + getTypeCheckerDiagnostics(sourceFile?: SourceFile): Diagnostic[]; + getTypeCheckerGlobalDiagnostics(): Diagnostic[]; getDiagnostics(sourceFile?: SourceFile): Diagnostic[]; getGlobalDiagnostics(): Diagnostic[]; getDeclarationDiagnostics(sourceFile: SourceFile): Diagnostic[]; @@ -819,8 +820,6 @@ declare module "typescript" { } interface TypeChecker { getEmitResolver(): EmitResolver; - getDiagnostics(sourceFile?: SourceFile): Diagnostic[]; - getGlobalDiagnostics(): Diagnostic[]; getTypeOfSymbolAtLocation(symbol: Symbol, node: Node): Type; getDeclaredTypeOfSymbol(symbol: Symbol): Type; getPropertiesOfType(type: Type): Symbol[]; @@ -1974,8 +1973,7 @@ function transform(contents, compilerOptions) { // Do not generate code in the presence of early errors if (!errors.length) { // Type check and get semantic errors - var checker = program.getTypeChecker(true); - errors = checker.getDiagnostics(); + errors = program.getTypeCheckerDiagnostics(); // Generate output program.emitFiles(); } diff --git a/tests/baselines/reference/APISample_transform.types b/tests/baselines/reference/APISample_transform.types index 2093ec7d8f5..bb9f6823e4c 100644 --- a/tests/baselines/reference/APISample_transform.types +++ b/tests/baselines/reference/APISample_transform.types @@ -162,20 +162,13 @@ function transform(contents: string, compilerOptions: ts.CompilerOptions = {}) { >length : number // Type check and get semantic errors - var checker = program.getTypeChecker(true); ->checker : ts.TypeChecker ->program.getTypeChecker(true) : ts.TypeChecker ->program.getTypeChecker : (produceDiagnostics: boolean) => ts.TypeChecker ->program : ts.Program ->getTypeChecker : (produceDiagnostics: boolean) => ts.TypeChecker - - errors = checker.getDiagnostics(); ->errors = checker.getDiagnostics() : ts.Diagnostic[] + errors = program.getTypeCheckerDiagnostics(); +>errors = program.getTypeCheckerDiagnostics() : ts.Diagnostic[] >errors : ts.Diagnostic[] ->checker.getDiagnostics() : ts.Diagnostic[] ->checker.getDiagnostics : (sourceFile?: ts.SourceFile) => ts.Diagnostic[] ->checker : ts.TypeChecker ->getDiagnostics : (sourceFile?: ts.SourceFile) => ts.Diagnostic[] +>program.getTypeCheckerDiagnostics() : ts.Diagnostic[] +>program.getTypeCheckerDiagnostics : (sourceFile?: ts.SourceFile) => ts.Diagnostic[] +>program : ts.Program +>getTypeCheckerDiagnostics : (sourceFile?: ts.SourceFile) => ts.Diagnostic[] // Generate output program.emitFiles(); @@ -2339,6 +2332,16 @@ declare module "typescript" { >getCompilerHost : () => CompilerHost >CompilerHost : CompilerHost + getTypeCheckerDiagnostics(sourceFile?: SourceFile): Diagnostic[]; +>getTypeCheckerDiagnostics : (sourceFile?: SourceFile) => Diagnostic[] +>sourceFile : SourceFile +>SourceFile : SourceFile +>Diagnostic : Diagnostic + + getTypeCheckerGlobalDiagnostics(): Diagnostic[]; +>getTypeCheckerGlobalDiagnostics : () => Diagnostic[] +>Diagnostic : Diagnostic + getDiagnostics(sourceFile?: SourceFile): Diagnostic[]; >getDiagnostics : (sourceFile?: SourceFile) => Diagnostic[] >sourceFile : SourceFile @@ -2489,16 +2492,6 @@ declare module "typescript" { >getEmitResolver : () => EmitResolver >EmitResolver : EmitResolver - getDiagnostics(sourceFile?: SourceFile): Diagnostic[]; ->getDiagnostics : (sourceFile?: SourceFile) => Diagnostic[] ->sourceFile : SourceFile ->SourceFile : SourceFile ->Diagnostic : Diagnostic - - getGlobalDiagnostics(): Diagnostic[]; ->getGlobalDiagnostics : () => Diagnostic[] ->Diagnostic : Diagnostic - getTypeOfSymbolAtLocation(symbol: Symbol, node: Node): Type; >getTypeOfSymbolAtLocation : (symbol: Symbol, node: Node) => Type >symbol : Symbol diff --git a/tests/baselines/reference/APISample_watcher.js b/tests/baselines/reference/APISample_watcher.js index 0e242eaca34..2abce891f35 100644 --- a/tests/baselines/reference/APISample_watcher.js +++ b/tests/baselines/reference/APISample_watcher.js @@ -808,6 +808,8 @@ declare module "typescript" { interface Program extends ScriptReferenceHost { getSourceFiles(): SourceFile[]; getCompilerHost(): CompilerHost; + getTypeCheckerDiagnostics(sourceFile?: SourceFile): Diagnostic[]; + getTypeCheckerGlobalDiagnostics(): Diagnostic[]; getDiagnostics(sourceFile?: SourceFile): Diagnostic[]; getGlobalDiagnostics(): Diagnostic[]; getDeclarationDiagnostics(sourceFile: SourceFile): Diagnostic[]; @@ -856,8 +858,6 @@ declare module "typescript" { } interface TypeChecker { getEmitResolver(): EmitResolver; - getDiagnostics(sourceFile?: SourceFile): Diagnostic[]; - getGlobalDiagnostics(): Diagnostic[]; getTypeOfSymbolAtLocation(symbol: Symbol, node: Node): Type; getDeclaredTypeOfSymbol(symbol: Symbol): Type; getPropertiesOfType(type: Type): Symbol[]; diff --git a/tests/baselines/reference/APISample_watcher.types b/tests/baselines/reference/APISample_watcher.types index 9255c64511c..949eab3e5eb 100644 --- a/tests/baselines/reference/APISample_watcher.types +++ b/tests/baselines/reference/APISample_watcher.types @@ -2517,6 +2517,16 @@ declare module "typescript" { >getCompilerHost : () => CompilerHost >CompilerHost : CompilerHost + getTypeCheckerDiagnostics(sourceFile?: SourceFile): Diagnostic[]; +>getTypeCheckerDiagnostics : (sourceFile?: SourceFile) => Diagnostic[] +>sourceFile : SourceFile +>SourceFile : SourceFile +>Diagnostic : Diagnostic + + getTypeCheckerGlobalDiagnostics(): Diagnostic[]; +>getTypeCheckerGlobalDiagnostics : () => Diagnostic[] +>Diagnostic : Diagnostic + getDiagnostics(sourceFile?: SourceFile): Diagnostic[]; >getDiagnostics : (sourceFile?: SourceFile) => Diagnostic[] >sourceFile : SourceFile @@ -2667,16 +2677,6 @@ declare module "typescript" { >getEmitResolver : () => EmitResolver >EmitResolver : EmitResolver - getDiagnostics(sourceFile?: SourceFile): Diagnostic[]; ->getDiagnostics : (sourceFile?: SourceFile) => Diagnostic[] ->sourceFile : SourceFile ->SourceFile : SourceFile ->Diagnostic : Diagnostic - - getGlobalDiagnostics(): Diagnostic[]; ->getGlobalDiagnostics : () => Diagnostic[] ->Diagnostic : Diagnostic - getTypeOfSymbolAtLocation(symbol: Symbol, node: Node): Type; >getTypeOfSymbolAtLocation : (symbol: Symbol, node: Node) => Type >symbol : Symbol diff --git a/tests/cases/compiler/APISample_compile.ts b/tests/cases/compiler/APISample_compile.ts index 757574c0d7d..5278fb16682 100644 --- a/tests/cases/compiler/APISample_compile.ts +++ b/tests/cases/compiler/APISample_compile.ts @@ -16,11 +16,10 @@ import ts = require("typescript"); export function compile(fileNames: string[], options: ts.CompilerOptions): void { var host = ts.createCompilerHost(options); var program = ts.createProgram(fileNames, options, host); - var checker = ts.createTypeChecker(program, /*produceDiagnostics*/ true); var result = program.emitFiles(); var allDiagnostics = program.getDiagnostics() - .concat(checker.getDiagnostics()) + .concat(program.getTypeCheckerDiagnostics()) .concat(result.diagnostics); allDiagnostics.forEach(diagnostic => { diff --git a/tests/cases/compiler/APISample_transform.ts b/tests/cases/compiler/APISample_transform.ts index c3e214b0e37..284e8a4dc5d 100644 --- a/tests/cases/compiler/APISample_transform.ts +++ b/tests/cases/compiler/APISample_transform.ts @@ -49,8 +49,7 @@ function transform(contents: string, compilerOptions: ts.CompilerOptions = {}) { // Do not generate code in the presence of early errors if (!errors.length) { // Type check and get semantic errors - var checker = program.getTypeChecker(true); - errors = checker.getDiagnostics(); + errors = program.getTypeCheckerDiagnostics(); // Generate output program.emitFiles(); }