diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 9f88df3aa8..6b722f8593 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -2236,6 +2236,7 @@ module ts { return emptyObjectType; } var type = getDeclaredTypeOfSymbol(symbol); + var name = symbol.name; if (!(type.flags & TypeFlags.ObjectType)) { error(getTypeDeclaration(symbol), Diagnostics.Global_type_0_must_be_a_class_or_interface_type, name); return emptyObjectType; diff --git a/tests/baselines/reference/noDefaultLib.errors.txt b/tests/baselines/reference/noDefaultLib.errors.txt new file mode 100644 index 0000000000..2f411affd5 --- /dev/null +++ b/tests/baselines/reference/noDefaultLib.errors.txt @@ -0,0 +1,15 @@ +!!! Cannot find global type 'Boolean'. +!!! Cannot find global type 'IArguments'. +==== tests/cases/compiler/noDefaultLib.ts (1 errors) ==== + /// + var x; + + interface Array {} + ~~~~~ +!!! Global type 'Array' must have 1 type parameter(s). + interface String {} + interface Number {} + interface Object {} + interface Date {} + interface Function {} + interface RegExp {} \ No newline at end of file diff --git a/tests/baselines/reference/noDefaultLib.js b/tests/baselines/reference/noDefaultLib.js new file mode 100644 index 0000000000..69e7f3d0cf --- /dev/null +++ b/tests/baselines/reference/noDefaultLib.js @@ -0,0 +1,15 @@ +//// [noDefaultLib.ts] +/// +var x; + +interface Array {} +interface String {} +interface Number {} +interface Object {} +interface Date {} +interface Function {} +interface RegExp {} + +//// [noDefaultLib.js] +/// +var x; diff --git a/tests/cases/compiler/noDefaultLib.ts b/tests/cases/compiler/noDefaultLib.ts new file mode 100644 index 0000000000..92c8a63fc6 --- /dev/null +++ b/tests/cases/compiler/noDefaultLib.ts @@ -0,0 +1,10 @@ +/// +var x; + +interface Array {} +interface String {} +interface Number {} +interface Object {} +interface Date {} +interface Function {} +interface RegExp {} \ No newline at end of file