mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Fix crash in reporting unresolved project reference as part of compilerOptions verification (#39095)
* Fix crash in reporting unresolved project reference as part of compilerOptions verification Fixes #38143 * Fix typo
This commit is contained in:
@@ -1530,7 +1530,7 @@ namespace ts {
|
||||
function getPrependNodes() {
|
||||
return createPrependNodes(
|
||||
projectReferences,
|
||||
(_ref, index) => resolvedProjectReferences![index]!.commandLine,
|
||||
(_ref, index) => resolvedProjectReferences![index]?.commandLine,
|
||||
fileName => {
|
||||
const path = toPath(fileName);
|
||||
const sourceFile = getSourceFileByPath(path);
|
||||
|
||||
@@ -130,6 +130,7 @@
|
||||
"unittests/tsc/declarationEmit.ts",
|
||||
"unittests/tsc/incremental.ts",
|
||||
"unittests/tsc/listFilesOnly.ts",
|
||||
"unittests/tsc/projectReferences.ts",
|
||||
"unittests/tsc/runWithoutArgs.ts",
|
||||
"unittests/tscWatch/consoleClearing.ts",
|
||||
"unittests/tscWatch/emit.ts",
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
namespace ts {
|
||||
describe("unittests:: tsc:: projectReferences::", () => {
|
||||
verifyTsc({
|
||||
scenario: "projectReferences",
|
||||
subScenario: "when project contains invalid project reference",
|
||||
fs: () => loadProjectFromFiles({
|
||||
"/src/project/src/main.ts": "export const x = 10;",
|
||||
"/src/project/tsconfig.json": JSON.stringify({
|
||||
compilerOptions: {
|
||||
module: "amd",
|
||||
outFile: "theApp.js"
|
||||
},
|
||||
references: [
|
||||
{ path: "../Util/Dates" }
|
||||
]
|
||||
}),
|
||||
}),
|
||||
commandLineArgs: ["--p", "src/project"],
|
||||
});
|
||||
});
|
||||
}
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
Input::
|
||||
//// [/lib/lib.d.ts]
|
||||
/// <reference no-default-lib="true"/>
|
||||
interface Boolean {}
|
||||
interface Function {}
|
||||
interface CallableFunction {}
|
||||
interface NewableFunction {}
|
||||
interface IArguments {}
|
||||
interface Number { toExponential: any; }
|
||||
interface Object {}
|
||||
interface RegExp {}
|
||||
interface String { charAt: any; }
|
||||
interface Array<T> { length: number; [n: number]: T; }
|
||||
interface ReadonlyArray<T> {}
|
||||
declare const console: { log(msg: any): void; };
|
||||
|
||||
//// [/src/project/src/main.ts]
|
||||
export const x = 10;
|
||||
|
||||
//// [/src/project/tsconfig.json]
|
||||
{"compilerOptions":{"module":"amd","outFile":"theApp.js"},"references":[{"path":"../Util/Dates"}]}
|
||||
|
||||
|
||||
|
||||
Output::
|
||||
/lib/tsc --p src/project
|
||||
[96msrc/project/tsconfig.json[0m:[93m1[0m:[93m73[0m - [91merror[0m[90m TS6053: [0mFile '/src/Util/Dates' not found.
|
||||
|
||||
[7m1[0m {"compilerOptions":{"module":"amd","outFile":"theApp.js"},"references":[{"path":"../Util/Dates"}]}
|
||||
[7m [0m [91m ~~~~~~~~~~~~~~~~~~~~~~~~[0m
|
||||
|
||||
|
||||
Found 1 error.
|
||||
|
||||
exitCode:: ExitStatus.DiagnosticsPresent_OutputsGenerated
|
||||
|
||||
|
||||
//// [/src/project/theApp.js]
|
||||
define("main", ["require", "exports"], function (require, exports) {
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
exports.x = void 0;
|
||||
exports.x = 10;
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user