Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Forbid the flag of --out, --outFile with the use of --isolatedDeclarations #128

Merged
merged 1 commit into from
Dec 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/compiler/program.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4169,6 +4169,16 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg
}
}

if (options.isolatedDeclarations) {
if (options.out) {
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "isolatedDeclarations");
}

if (options.outFile) {
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "outFile", "isolatedDeclarations");
}
}

if (options.inlineSourceMap) {
if (options.sourceMap) {
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "sourceMap", "inlineSourceMap");
Expand Down
8 changes: 8 additions & 0 deletions tests/baselines/reference/isolatedDeclarations.errors.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
error TS5053: Option 'outFile' cannot be specified with option 'isolatedDeclarations'.


!!! error TS5053: Option 'outFile' cannot be specified with option 'isolatedDeclarations'.
==== file1.ts (0 errors) ====
export var x;
==== file2.ts (0 errors) ====
var y;
14 changes: 14 additions & 0 deletions tests/baselines/reference/isolatedDeclarations.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//// [tests/cases/compiler/isolatedDeclarations.ts] ////

//// [file1.ts]
export var x;
//// [file2.ts]
var y;

//// [all.js]
define("file1", ["require", "exports"], function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.x = void 0;
});
var y;
10 changes: 10 additions & 0 deletions tests/baselines/reference/isolatedDeclarations.symbols
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
//// [tests/cases/compiler/isolatedDeclarations.ts] ////

=== file1.ts ===
export var x;
>x : Symbol(x, Decl(file1.ts, 0, 10))

=== file2.ts ===
var y;
>y : Symbol(y, Decl(file2.ts, 0, 3))

10 changes: 10 additions & 0 deletions tests/baselines/reference/isolatedDeclarations.types
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
//// [tests/cases/compiler/isolatedDeclarations.ts] ////

=== file1.ts ===
export var x;
>x : any

=== file2.ts ===
var y;
>y : any

9 changes: 9 additions & 0 deletions tests/cases/compiler/isolatedDeclarations.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// @isolatedDeclarations: true
// @outFile:all.js
// @target: es6
// @module: amd

// @filename: file1.ts
export var x;
// @filename: file2.ts
var y;