mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-27 04:48:33 -05:00
Test cases to verify that declaration file is not emitted if any of the declaration file in program has error
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
tests/cases/compiler/declFile.d.ts(3,5): error TS1038: A 'declare' modifier cannot be used in an already ambient context.
|
||||
tests/cases/compiler/declFile.d.ts(4,5): error TS1038: A 'declare' modifier cannot be used in an already ambient context.
|
||||
tests/cases/compiler/declFile.d.ts(6,5): error TS1038: A 'declare' modifier cannot be used in an already ambient context.
|
||||
tests/cases/compiler/declFile.d.ts(8,5): error TS1038: A 'declare' modifier cannot be used in an already ambient context.
|
||||
|
||||
|
||||
==== tests/cases/compiler/client.ts (0 errors) ====
|
||||
///<reference path="declFile.d.ts"/>
|
||||
var x = new M.C(); // Declaration file wont get emitted because there are errors in declaration file
|
||||
|
||||
==== tests/cases/compiler/declFile.d.ts (4 errors) ====
|
||||
|
||||
declare module M {
|
||||
declare var x;
|
||||
~~~~~~~
|
||||
!!! error TS1038: A 'declare' modifier cannot be used in an already ambient context.
|
||||
declare function f();
|
||||
~~~~~~~
|
||||
!!! error TS1038: A 'declare' modifier cannot be used in an already ambient context.
|
||||
|
||||
declare module N { }
|
||||
~~~~~~~
|
||||
!!! error TS1038: A 'declare' modifier cannot be used in an already ambient context.
|
||||
|
||||
declare class C { }
|
||||
~~~~~~~
|
||||
!!! error TS1038: A 'declare' modifier cannot be used in an already ambient context.
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
//// [tests/cases/compiler/declFileWithErrorsInInputDeclarationFile.ts] ////
|
||||
|
||||
//// [declFile.d.ts]
|
||||
|
||||
declare module M {
|
||||
declare var x;
|
||||
declare function f();
|
||||
|
||||
declare module N { }
|
||||
|
||||
declare class C { }
|
||||
}
|
||||
|
||||
//// [client.ts]
|
||||
///<reference path="declFile.d.ts"/>
|
||||
var x = new M.C(); // Declaration file wont get emitted because there are errors in declaration file
|
||||
|
||||
|
||||
//// [client.js]
|
||||
///<reference path="declFile.d.ts"/>
|
||||
var x = new M.C(); // Declaration file wont get emitted because there are errors in declaration file
|
||||
@@ -0,0 +1,29 @@
|
||||
tests/cases/compiler/declFile.d.ts(3,5): error TS1038: A 'declare' modifier cannot be used in an already ambient context.
|
||||
tests/cases/compiler/declFile.d.ts(4,5): error TS1038: A 'declare' modifier cannot be used in an already ambient context.
|
||||
tests/cases/compiler/declFile.d.ts(6,5): error TS1038: A 'declare' modifier cannot be used in an already ambient context.
|
||||
tests/cases/compiler/declFile.d.ts(8,5): error TS1038: A 'declare' modifier cannot be used in an already ambient context.
|
||||
|
||||
|
||||
==== tests/cases/compiler/client.ts (0 errors) ====
|
||||
///<reference path="declFile.d.ts"/>
|
||||
var x = new M.C(); // Declaration file wont get emitted because there are errors in declaration file
|
||||
|
||||
==== tests/cases/compiler/declFile.d.ts (4 errors) ====
|
||||
|
||||
declare module M {
|
||||
declare var x;
|
||||
~~~~~~~
|
||||
!!! error TS1038: A 'declare' modifier cannot be used in an already ambient context.
|
||||
declare function f();
|
||||
~~~~~~~
|
||||
!!! error TS1038: A 'declare' modifier cannot be used in an already ambient context.
|
||||
|
||||
declare module N { }
|
||||
~~~~~~~
|
||||
!!! error TS1038: A 'declare' modifier cannot be used in an already ambient context.
|
||||
|
||||
declare class C { }
|
||||
~~~~~~~
|
||||
!!! error TS1038: A 'declare' modifier cannot be used in an already ambient context.
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
//// [tests/cases/compiler/declFileWithErrorsInInputDeclarationFileWithOut.ts] ////
|
||||
|
||||
//// [declFile.d.ts]
|
||||
|
||||
declare module M {
|
||||
declare var x;
|
||||
declare function f();
|
||||
|
||||
declare module N { }
|
||||
|
||||
declare class C { }
|
||||
}
|
||||
|
||||
//// [client.ts]
|
||||
///<reference path="declFile.d.ts"/>
|
||||
var x = new M.C(); // Declaration file wont get emitted because there are errors in declaration file
|
||||
|
||||
|
||||
//// [out.js]
|
||||
///<reference path="declFile.d.ts"/>
|
||||
var x = new M.C(); // Declaration file wont get emitted because there are errors in declaration file
|
||||
@@ -0,0 +1,15 @@
|
||||
// @declaration: true
|
||||
|
||||
// @Filename: declFile.d.ts
|
||||
declare module M {
|
||||
declare var x;
|
||||
declare function f();
|
||||
|
||||
declare module N { }
|
||||
|
||||
declare class C { }
|
||||
}
|
||||
|
||||
// @Filename: client.ts
|
||||
///<reference path="declFile.d.ts"/>
|
||||
var x = new M.C(); // Declaration file wont get emitted because there are errors in declaration file
|
||||
@@ -0,0 +1,16 @@
|
||||
// @declaration: true
|
||||
// @out: out.js
|
||||
|
||||
// @Filename: declFile.d.ts
|
||||
declare module M {
|
||||
declare var x;
|
||||
declare function f();
|
||||
|
||||
declare module N { }
|
||||
|
||||
declare class C { }
|
||||
}
|
||||
|
||||
// @Filename: client.ts
|
||||
///<reference path="declFile.d.ts"/>
|
||||
var x = new M.C(); // Declaration file wont get emitted because there are errors in declaration file
|
||||
Reference in New Issue
Block a user