Skip to content

Commit 828e31b

Browse files
Baselines, using 'unknown' as a default type.
1 parent e8ec296 commit 828e31b

File tree

6 files changed

+5
-13
lines changed

6 files changed

+5
-13
lines changed

src/compiler/checker.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9103,9 +9103,11 @@ module ts {
91039103
globalBooleanType = getGlobalType("Boolean");
91049104
globalRegExpType = getGlobalType("RegExp");
91059105

9106-
if (compilerOptions.target >= ScriptTarget.ES6) {
9107-
globalTemplateStringsArrayType = getGlobalType("TemplateStringsArray");
9108-
}
9106+
// If we're in ES6 mode, load the TemplateStringsArray.
9107+
// Otherwise, default to 'unknown' for the purposes of type checking in LS scenarios.
9108+
globalTemplateStringsArrayType = compilerOptions.target >= ScriptTarget.ES6
9109+
? getGlobalType("TemplateStringsArray")
9110+
: unknownType;
91099111
}
91109112

91119113
initializeTypeChecker();

tests/baselines/reference/noDefaultLib.errors.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
error TS2318: Cannot find global type 'Boolean'.
22
error TS2318: Cannot find global type 'IArguments'.
3-
error TS2318: Cannot find global type 'TemplateStringsArray'.
43
tests/cases/compiler/noDefaultLib.ts(4,11): error TS2317: Global type 'Array' must have 1 type parameter(s).
54

65

76
!!! error TS2318: Cannot find global type 'Boolean'.
87
!!! error TS2318: Cannot find global type 'IArguments'.
9-
!!! error TS2318: Cannot find global type 'TemplateStringsArray'.
108
==== tests/cases/compiler/noDefaultLib.ts (1 errors) ====
119
/// <reference no-default-lib="true"/>
1210
var x;

tests/baselines/reference/parser509698.errors.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ error TS2318: Cannot find global type 'Number'.
66
error TS2318: Cannot find global type 'Object'.
77
error TS2318: Cannot find global type 'RegExp'.
88
error TS2318: Cannot find global type 'String'.
9-
error TS2318: Cannot find global type 'TemplateStringsArray'.
109

1110

1211
!!! error TS2318: Cannot find global type 'Array'.
@@ -17,7 +16,6 @@ error TS2318: Cannot find global type 'TemplateStringsArray'.
1716
!!! error TS2318: Cannot find global type 'Object'.
1817
!!! error TS2318: Cannot find global type 'RegExp'.
1918
!!! error TS2318: Cannot find global type 'String'.
20-
!!! error TS2318: Cannot find global type 'TemplateStringsArray'.
2119
==== tests/cases/conformance/parser/ecmascript5/RegressionTests/parser509698.ts (0 errors) ====
2220
/// <style requireSemi="on" />
2321
/// <reference no-default-lib="true"/>

tests/baselines/reference/project/noDefaultLib/amd/noDefaultLib.errors.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ error TS2318: Cannot find global type 'Number'.
66
error TS2318: Cannot find global type 'Object'.
77
error TS2318: Cannot find global type 'RegExp'.
88
error TS2318: Cannot find global type 'String'.
9-
error TS2318: Cannot find global type 'TemplateStringsArray'.
109
test.ts(3,8): error TS2304: Cannot find name 'Array'.
1110

1211

@@ -18,7 +17,6 @@ test.ts(3,8): error TS2304: Cannot find name 'Array'.
1817
!!! error TS2318: Cannot find global type 'Object'.
1918
!!! error TS2318: Cannot find global type 'RegExp'.
2019
!!! error TS2318: Cannot find global type 'String'.
21-
!!! error TS2318: Cannot find global type 'TemplateStringsArray'.
2220
==== test.ts (1 errors) ====
2321
/// <reference no-default-lib="true"/>
2422

tests/baselines/reference/project/noDefaultLib/node/noDefaultLib.errors.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ error TS2318: Cannot find global type 'Number'.
66
error TS2318: Cannot find global type 'Object'.
77
error TS2318: Cannot find global type 'RegExp'.
88
error TS2318: Cannot find global type 'String'.
9-
error TS2318: Cannot find global type 'TemplateStringsArray'.
109
test.ts(3,8): error TS2304: Cannot find name 'Array'.
1110

1211

@@ -18,7 +17,6 @@ test.ts(3,8): error TS2304: Cannot find name 'Array'.
1817
!!! error TS2318: Cannot find global type 'Object'.
1918
!!! error TS2318: Cannot find global type 'RegExp'.
2019
!!! error TS2318: Cannot find global type 'String'.
21-
!!! error TS2318: Cannot find global type 'TemplateStringsArray'.
2220
==== test.ts (1 errors) ====
2321
/// <reference no-default-lib="true"/>
2422

tests/baselines/reference/typeCheckTypeArgument.errors.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ error TS2318: Cannot find global type 'Number'.
66
error TS2318: Cannot find global type 'Object'.
77
error TS2318: Cannot find global type 'RegExp'.
88
error TS2318: Cannot find global type 'String'.
9-
error TS2318: Cannot find global type 'TemplateStringsArray'.
109
tests/cases/compiler/typeCheckTypeArgument.ts(3,19): error TS2304: Cannot find name 'UNKNOWN'.
1110
tests/cases/compiler/typeCheckTypeArgument.ts(5,26): error TS2304: Cannot find name 'UNKNOWN'.
1211
tests/cases/compiler/typeCheckTypeArgument.ts(7,21): error TS2304: Cannot find name 'UNKNOWN'.
@@ -23,7 +22,6 @@ tests/cases/compiler/typeCheckTypeArgument.ts(15,13): error TS2304: Cannot find
2322
!!! error TS2318: Cannot find global type 'Object'.
2423
!!! error TS2318: Cannot find global type 'RegExp'.
2524
!!! error TS2318: Cannot find global type 'String'.
26-
!!! error TS2318: Cannot find global type 'TemplateStringsArray'.
2725
==== tests/cases/compiler/typeCheckTypeArgument.ts (6 errors) ====
2826
/// <reference no-default-lib="true"/>
2927

0 commit comments

Comments
 (0)