mirror of
https://gitee.com/openharmony/third_party_typescript
synced 2024-12-02 20:30:02 +00:00
Fix undefined symbol name in error message
This commit is contained in:
parent
062823c3d5
commit
211008d015
@ -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;
|
||||
|
15
tests/baselines/reference/noDefaultLib.errors.txt
Normal file
15
tests/baselines/reference/noDefaultLib.errors.txt
Normal file
@ -0,0 +1,15 @@
|
||||
!!! Cannot find global type 'Boolean'.
|
||||
!!! Cannot find global type 'IArguments'.
|
||||
==== tests/cases/compiler/noDefaultLib.ts (1 errors) ====
|
||||
/// <reference no-default-lib="true"/>
|
||||
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 {}
|
15
tests/baselines/reference/noDefaultLib.js
Normal file
15
tests/baselines/reference/noDefaultLib.js
Normal file
@ -0,0 +1,15 @@
|
||||
//// [noDefaultLib.ts]
|
||||
/// <reference no-default-lib="true"/>
|
||||
var x;
|
||||
|
||||
interface Array {}
|
||||
interface String {}
|
||||
interface Number {}
|
||||
interface Object {}
|
||||
interface Date {}
|
||||
interface Function {}
|
||||
interface RegExp {}
|
||||
|
||||
//// [noDefaultLib.js]
|
||||
/// <reference no-default-lib="true"/>
|
||||
var x;
|
10
tests/cases/compiler/noDefaultLib.ts
Normal file
10
tests/cases/compiler/noDefaultLib.ts
Normal file
@ -0,0 +1,10 @@
|
||||
/// <reference no-default-lib="true"/>
|
||||
var x;
|
||||
|
||||
interface Array {}
|
||||
interface String {}
|
||||
interface Number {}
|
||||
interface Object {}
|
||||
interface Date {}
|
||||
interface Function {}
|
||||
interface RegExp {}
|
Loading…
Reference in New Issue
Block a user