diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 5a990d4e9d..11d9187583 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -9102,7 +9102,12 @@ module ts { globalNumberType = getGlobalType("Number"); globalBooleanType = getGlobalType("Boolean"); globalRegExpType = getGlobalType("RegExp"); - globalTemplateStringsArrayType = getGlobalType("TemplateStringsArray"); + + // If we're in ES6 mode, load the TemplateStringsArray. + // Otherwise, default to 'unknown' for the purposes of type checking in LS scenarios. + globalTemplateStringsArrayType = compilerOptions.target >= ScriptTarget.ES6 + ? getGlobalType("TemplateStringsArray") + : unknownType; } initializeTypeChecker(); diff --git a/src/harness/harness.ts b/src/harness/harness.ts index ab20e56185..f77cd09929 100644 --- a/src/harness/harness.ts +++ b/src/harness/harness.ts @@ -15,6 +15,7 @@ /// /// +/// /// /// /// @@ -1002,8 +1003,12 @@ module Harness { assert.equal(markedErrorCount, fileErrors.length, 'count of errors in ' + inputFile.unitName); }); + var numLibraryDiagnostics = ts.countWhere(diagnostics, diagnostic => { + return diagnostic.filename && isLibraryFile(diagnostic.filename); + }); + // Verify we didn't miss any errors in total - assert.equal(totalErrorsReported, diagnostics.length, 'total number of errors'); + assert.equal(totalErrorsReported + numLibraryDiagnostics, diagnostics.length, 'total number of errors'); return minimalDiagnosticsToString(diagnostics) + sys.newLine + sys.newLine + outputLines.join('\r\n'); diff --git a/tests/baselines/reference/noDefaultLib.errors.txt b/tests/baselines/reference/noDefaultLib.errors.txt index f2c23d56d2..0209895005 100644 --- a/tests/baselines/reference/noDefaultLib.errors.txt +++ b/tests/baselines/reference/noDefaultLib.errors.txt @@ -1,12 +1,10 @@ error TS2318: Cannot find global type 'Boolean'. error TS2318: Cannot find global type 'IArguments'. -error TS2318: Cannot find global type 'TemplateStringsArray'. tests/cases/compiler/noDefaultLib.ts(4,11): error TS2317: Global type 'Array' must have 1 type parameter(s). !!! error TS2318: Cannot find global type 'Boolean'. !!! error TS2318: Cannot find global type 'IArguments'. -!!! error TS2318: Cannot find global type 'TemplateStringsArray'. ==== tests/cases/compiler/noDefaultLib.ts (1 errors) ==== /// var x; diff --git a/tests/baselines/reference/parser509698.errors.txt b/tests/baselines/reference/parser509698.errors.txt index 2a8cc607e1..2aaaec18dc 100644 --- a/tests/baselines/reference/parser509698.errors.txt +++ b/tests/baselines/reference/parser509698.errors.txt @@ -6,7 +6,6 @@ error TS2318: Cannot find global type 'Number'. error TS2318: Cannot find global type 'Object'. error TS2318: Cannot find global type 'RegExp'. error TS2318: Cannot find global type 'String'. -error TS2318: Cannot find global type 'TemplateStringsArray'. !!! error TS2318: Cannot find global type 'Array'. @@ -17,7 +16,6 @@ error TS2318: Cannot find global type 'TemplateStringsArray'. !!! error TS2318: Cannot find global type 'Object'. !!! error TS2318: Cannot find global type 'RegExp'. !!! error TS2318: Cannot find global type 'String'. -!!! error TS2318: Cannot find global type 'TemplateStringsArray'. ==== tests/cases/conformance/parser/ecmascript5/RegressionTests/parser509698.ts (0 errors) ==== ///