mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-15 03:23:08 -06:00
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:
commit
7852cf7ed3
@ -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) {
|
||||
|
||||
@ -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;
|
||||
@ -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))
|
||||
|
||||
@ -0,0 +1,8 @@
|
||||
=== /foo/test.ts ===
|
||||
interface Foo {
|
||||
x: number;
|
||||
>x : number
|
||||
}
|
||||
export default Foo;
|
||||
>Foo : Foo
|
||||
|
||||
@ -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;
|
||||
@ -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))
|
||||
|
||||
@ -0,0 +1,8 @@
|
||||
=== /foo/test.ts ===
|
||||
interface Foo {
|
||||
x: number;
|
||||
>x : number
|
||||
}
|
||||
export default Foo;
|
||||
>Foo : Foo
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -0,0 +1,10 @@
|
||||
//// [test.ts]
|
||||
interface Foo {
|
||||
x: number;
|
||||
}
|
||||
export default Foo;
|
||||
|
||||
|
||||
//// [test.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
@ -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))
|
||||
|
||||
@ -0,0 +1,8 @@
|
||||
=== /foo/test.ts ===
|
||||
interface Foo {
|
||||
x: number;
|
||||
>x : number
|
||||
}
|
||||
export default Foo;
|
||||
>Foo : Foo
|
||||
|
||||
@ -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;
|
||||
@ -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;
|
||||
@ -0,0 +1,10 @@
|
||||
// @filename: /foo/tsconfig.json
|
||||
{
|
||||
"compilerOptions": { "declarationDir": "out" }
|
||||
}
|
||||
|
||||
// @filename: /foo/test.ts
|
||||
interface Foo {
|
||||
x: number;
|
||||
}
|
||||
export default Foo;
|
||||
Loading…
x
Reference in New Issue
Block a user