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. 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. 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. 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. tests/cases/conformance/ambient/ambientErrors.ts(47,20): error TS2435: Ambient external modules cannot be nested in other modules. tests/cases/conformance/ambient/ambientErrors.ts(51,16): error TS2436: Ambient external 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. ==== tests/cases/conformance/ambient/ambientErrors.ts (16 errors) ==== // Ambient variable with an initializer declare var x = 4; ~ !!! error TS1039: Initializers are not allowed in ambient contexts. // 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. // 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. // Ambient function with function body declare function fn4() { }; ~ !!! error TS1184: An implementation cannot be declared in ambient contexts. // 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. } // Ambient enum with computer member declare enum E2 { x = 'foo'.length ~ !!! error TS1066: Ambient enum elements can only have integer literal initializers. } // 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. function fn() { } ~ !!! error TS1184: An implementation cannot be declared in ambient contexts. class C { static x = 3; ~ !!! error TS1039: Initializers are not allowed in ambient contexts. y = 4; ~ !!! error TS1039: Initializers are not allowed in ambient contexts. constructor() { } ~ !!! error TS1184: An implementation cannot be declared in ambient contexts. fn() { } ~ !!! error TS1184: An implementation cannot be declared in ambient contexts. static sfn() { } ~ !!! error TS1184: An implementation cannot be declared in ambient contexts. } } // Ambient external module not in the global module module M2 { declare module 'nope' { } ~~~~~~ !!! error TS2435: Ambient external modules cannot be nested in other modules. } // Ambient external module with a string literal name that isn't a top level external module name declare module '../foo' { } ~~~~~~~~ !!! error TS2436: Ambient external module declaration cannot specify relative module name. // 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. }