Merge pull request #27175 from a-tarasyuk/bug/error-using-declaration-dir-with-composite

#26862: allow using declarationDir with composite option
This commit is contained in:
Sheetal Nandi 2018-09-18 10:53:38 -07:00 committed by GitHub
commit 7852cf7ed3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 147 additions and 1 deletions

View File

@ -2532,7 +2532,7 @@ namespace ts {
}
if (options.declarationDir) {
if (!options.declaration) {
if (!getEmitDeclarations(options)) {
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "declarationDir", "declaration");
}
if (options.out || options.outFile) {

View File

@ -0,0 +1,17 @@
//// [test.ts]
interface Foo {
x: number;
}
export default Foo;
//// [test.js]
"use strict";
exports.__esModule = true;
//// [test.d.ts]
interface Foo {
x: number;
}
export default Foo;

View File

@ -0,0 +1,10 @@
=== /foo/test.ts ===
interface Foo {
>Foo : Symbol(Foo, Decl(test.ts, 0, 0))
x: number;
>x : Symbol(Foo.x, Decl(test.ts, 0, 15))
}
export default Foo;
>Foo : Symbol(Foo, Decl(test.ts, 0, 0))

View File

@ -0,0 +1,8 @@
=== /foo/test.ts ===
interface Foo {
x: number;
>x : number
}
export default Foo;
>Foo : Foo

View File

@ -0,0 +1,17 @@
//// [test.ts]
interface Foo {
x: number;
}
export default Foo;
//// [test.js]
"use strict";
exports.__esModule = true;
//// [test.d.ts]
interface Foo {
x: number;
}
export default Foo;

View File

@ -0,0 +1,10 @@
=== /foo/test.ts ===
interface Foo {
>Foo : Symbol(Foo, Decl(test.ts, 0, 0))
x: number;
>x : Symbol(Foo.x, Decl(test.ts, 0, 15))
}
export default Foo;
>Foo : Symbol(Foo, Decl(test.ts, 0, 0))

View File

@ -0,0 +1,8 @@
=== /foo/test.ts ===
interface Foo {
x: number;
>x : number
}
export default Foo;
>Foo : Foo

View File

@ -0,0 +1,16 @@
/foo/tsconfig.json(2,26): error TS5052: Option 'declarationDir' cannot be specified without specifying option 'declaration'.
==== /foo/tsconfig.json (1 errors) ====
{
"compilerOptions": { "declarationDir": "out" }
~~~~~~~~~~~~~~~~
!!! error TS5052: Option 'declarationDir' cannot be specified without specifying option 'declaration'.
}
==== /foo/test.ts (0 errors) ====
interface Foo {
x: number;
}
export default Foo;

View File

@ -0,0 +1,10 @@
//// [test.ts]
interface Foo {
x: number;
}
export default Foo;
//// [test.js]
"use strict";
exports.__esModule = true;

View File

@ -0,0 +1,10 @@
=== /foo/test.ts ===
interface Foo {
>Foo : Symbol(Foo, Decl(test.ts, 0, 0))
x: number;
>x : Symbol(Foo.x, Decl(test.ts, 0, 15))
}
export default Foo;
>Foo : Symbol(Foo, Decl(test.ts, 0, 0))

View File

@ -0,0 +1,8 @@
=== /foo/test.ts ===
interface Foo {
x: number;
>x : number
}
export default Foo;
>Foo : Foo

View File

@ -0,0 +1,11 @@
// @composite: true
// @filename: /foo/tsconfig.json
{
"compilerOptions": { "composite": true, "declarationDir": "out" }
}
// @filename: /foo/test.ts
interface Foo {
x: number;
}
export default Foo;

View File

@ -0,0 +1,11 @@
// @declaration: true
// @filename: /foo/tsconfig.json
{
"compilerOptions": { "declaration": true, "declarationDir": "out" }
}
// @filename: /foo/test.ts
interface Foo {
x: number;
}
export default Foo;

View File

@ -0,0 +1,10 @@
// @filename: /foo/tsconfig.json
{
"compilerOptions": { "declarationDir": "out" }
}
// @filename: /foo/test.ts
interface Foo {
x: number;
}
export default Foo;