TypeScript/tests/baselines/reference/ambientErrors.errors.txt

110 lines
5.4 KiB
Plaintext
Raw Normal View History

tests/cases/conformance/ambient/ambientErrors.ts(2,15): error TS1039: Initializers are not allowed in ambient contexts.
tests/cases/conformance/ambient/ambientErrors.ts(6,18): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
tests/cases/conformance/ambient/ambientErrors.ts(17,22): error TS2371: A parameter initializer is only allowed in a function or constructor implementation.
2014-12-17 04:11:07 +01:00
tests/cases/conformance/ambient/ambientErrors.ts(20,24): error TS1184: An implementation cannot be declared in ambient contexts.
tests/cases/conformance/ambient/ambientErrors.ts(24,5): error TS1066: Ambient enum elements can only have integer literal initializers.
tests/cases/conformance/ambient/ambientErrors.ts(29,5): error TS1066: Ambient enum elements can only have integer literal initializers.
tests/cases/conformance/ambient/ambientErrors.ts(34,11): error TS1039: Initializers are not allowed in ambient contexts.
2014-12-17 04:11:07 +01:00
tests/cases/conformance/ambient/ambientErrors.ts(35,19): error TS1184: An implementation cannot be declared in ambient contexts.
tests/cases/conformance/ambient/ambientErrors.ts(37,20): error TS1039: Initializers are not allowed in ambient contexts.
tests/cases/conformance/ambient/ambientErrors.ts(38,13): error TS1039: Initializers are not allowed in ambient contexts.
2014-12-17 04:11:07 +01:00
tests/cases/conformance/ambient/ambientErrors.ts(39,23): error TS1184: An implementation cannot be declared in ambient contexts.
tests/cases/conformance/ambient/ambientErrors.ts(40,14): error TS1184: An implementation cannot be declared in ambient contexts.
tests/cases/conformance/ambient/ambientErrors.ts(41,22): error TS1184: An implementation cannot be declared in ambient contexts.
2015-04-27 03:31:47 +02:00
tests/cases/conformance/ambient/ambientErrors.ts(47,20): error TS2435: Ambient modules cannot be nested in other modules.
tests/cases/conformance/ambient/ambientErrors.ts(51,16): error TS2436: Ambient module declaration cannot specify relative module name.
tests/cases/conformance/ambient/ambientErrors.ts(57,5): error TS2309: An export assignment cannot be used in a module with other exported elements.
2014-12-17 04:11:07 +01:00
==== tests/cases/conformance/ambient/ambientErrors.ts (16 errors) ====
2014-07-13 01:04:16 +02:00
// Ambient variable with an initializer
declare var x = 4;
~
!!! error TS1039: Initializers are not allowed in ambient contexts.
2014-07-13 01:04:16 +02:00
// Ambient functions with invalid overloads
declare function fn(x: number): string;
declare function fn(x: 'foo'): number;
~~
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
2014-07-13 01:04:16 +02:00
// Ambient functions with duplicate signatures
declare function fn1(x: number): string;
declare function fn1(x: number): string;
// Ambient function overloads that differ only by return type
declare function fn2(x: number): string;
declare function fn2(x: number): number;
// Ambient function with default parameter values
declare function fn3(x = 3);
~~~~~
!!! error TS2371: A parameter initializer is only allowed in a function or constructor implementation.
2014-07-13 01:04:16 +02:00
// Ambient function with function body
declare function fn4() { };
~
2014-12-17 04:11:07 +01:00
!!! error TS1184: An implementation cannot be declared in ambient contexts.
2014-07-13 01:04:16 +02:00
// Ambient enum with non - integer literal constant member
declare enum E1 {
y = 4.23
~
!!! error TS1066: Ambient enum elements can only have integer literal initializers.
2014-07-13 01:04:16 +02:00
}
// Ambient enum with computer member
declare enum E2 {
x = 'foo'.length
~
!!! error TS1066: Ambient enum elements can only have integer literal initializers.
2014-07-13 01:04:16 +02:00
}
// Ambient module with initializers for values, bodies for functions / classes
declare module M1 {
var x = 3;
~
!!! error TS1039: Initializers are not allowed in ambient contexts.
2014-07-13 01:04:16 +02:00
function fn() { }
~
2014-12-17 04:11:07 +01:00
!!! error TS1184: An implementation cannot be declared in ambient contexts.
2014-07-13 01:04:16 +02:00
class C {
static x = 3;
~
!!! error TS1039: Initializers are not allowed in ambient contexts.
2014-07-13 01:04:16 +02:00
y = 4;
~
!!! error TS1039: Initializers are not allowed in ambient contexts.
2014-07-13 01:04:16 +02:00
constructor() { }
~
2014-12-17 04:11:07 +01:00
!!! error TS1184: An implementation cannot be declared in ambient contexts.
2014-07-13 01:04:16 +02:00
fn() { }
~
!!! error TS1184: An implementation cannot be declared in ambient contexts.
2014-07-13 01:04:16 +02:00
static sfn() { }
~
!!! error TS1184: An implementation cannot be declared in ambient contexts.
2014-07-13 01:04:16 +02:00
}
}
// Ambient external module not in the global module
module M2 {
declare module 'nope' { }
2014-07-17 01:15:10 +02:00
~~~~~~
2015-04-27 03:31:47 +02:00
!!! error TS2435: Ambient modules cannot be nested in other modules.
2014-07-13 01:04:16 +02:00
}
// Ambient external module with a string literal name that isn't a top level external module name
declare module '../foo' { }
2014-07-17 01:15:10 +02:00
~~~~~~~~
2015-04-27 03:31:47 +02:00
!!! error TS2436: Ambient module declaration cannot specify relative module name.
2014-07-13 01:04:16 +02:00
// Ambient external module with export assignment and other exported members
declare module 'bar' {
var n;
export var q;
export = n;
~~~~~~~~~~~
!!! error TS2309: An export assignment cannot be used in a module with other exported elements.
2014-07-13 01:04:16 +02:00
}