mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-12 01:48:33 -05:00
Merge pull request #27176 from a-tarasyuk/bug/26786-no-error-when-using-allowjs-with-composite
#26786: deny using allowJs option with composite
This commit is contained in:
@@ -2609,8 +2609,8 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
if (!options.noEmit && options.allowJs && options.declaration) {
|
||||
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "allowJs", "declaration");
|
||||
if (!options.noEmit && options.allowJs && getEmitDeclarations(options)) {
|
||||
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "allowJs", options.declaration ? "declaration" : "composite");
|
||||
}
|
||||
|
||||
if (options.checkJs && !options.allowJs) {
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
error TS5053: Option 'allowJs' cannot be specified with option 'composite'.
|
||||
|
||||
|
||||
!!! error TS5053: Option 'allowJs' cannot be specified with option 'composite'.
|
||||
==== tests/cases/compiler/a.ts (0 errors) ====
|
||||
class c {
|
||||
}
|
||||
|
||||
==== tests/cases/compiler/b.js (0 errors) ====
|
||||
function foo() {
|
||||
}
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
//// [tests/cases/compiler/jsFileCompilationWithEnabledCompositeOption.ts] ////
|
||||
|
||||
//// [a.ts]
|
||||
class c {
|
||||
}
|
||||
|
||||
//// [b.js]
|
||||
function foo() {
|
||||
}
|
||||
|
||||
|
||||
//// [out.js]
|
||||
var c = /** @class */ (function () {
|
||||
function c() {
|
||||
}
|
||||
return c;
|
||||
}());
|
||||
function foo() {
|
||||
}
|
||||
|
||||
|
||||
//// [out.d.ts]
|
||||
declare class c {
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
=== tests/cases/compiler/a.ts ===
|
||||
class c {
|
||||
>c : Symbol(c, Decl(a.ts, 0, 0))
|
||||
}
|
||||
|
||||
=== tests/cases/compiler/b.js ===
|
||||
function foo() {
|
||||
>foo : Symbol(foo, Decl(b.js, 0, 0))
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
=== tests/cases/compiler/a.ts ===
|
||||
class c {
|
||||
>c : c
|
||||
}
|
||||
|
||||
=== tests/cases/compiler/b.js ===
|
||||
function foo() {
|
||||
>foo : () => void
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
// @allowJs: true
|
||||
// @out: out.js
|
||||
// @composite: true
|
||||
// @filename: a.ts
|
||||
class c {
|
||||
}
|
||||
|
||||
// @filename: b.js
|
||||
function foo() {
|
||||
}
|
||||
Reference in New Issue
Block a user