diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts
index b7220fb89543d..96aa72edc26ae 100644
--- a/src/compiler/checker.ts
+++ b/src/compiler/checker.ts
@@ -2783,7 +2783,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
const moduleNotFoundError = !(moduleName.parent.parent.flags & NodeFlags.Ambient)
? Diagnostics.Invalid_module_name_in_augmentation_module_0_cannot_be_found
: undefined;
- let mainModule = resolveExternalModuleNameWorker(moduleName, moduleName, moduleNotFoundError, /*isForAugmentation*/ true);
+ let mainModule = resolveExternalModuleNameWorker(moduleName, moduleName, moduleNotFoundError, /*ignoreErrors*/ false, /*isForAugmentation*/ true);
if (!mainModule) {
return;
}
@@ -4547,17 +4547,17 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
const errorMessage = isClassic ?
Diagnostics.Cannot_find_module_0_Did_you_mean_to_set_the_moduleResolution_option_to_nodenext_or_to_add_aliases_to_the_paths_option
: Diagnostics.Cannot_find_module_0_or_its_corresponding_type_declarations;
- return resolveExternalModuleNameWorker(location, moduleReferenceExpression, ignoreErrors ? undefined : errorMessage);
+ return resolveExternalModuleNameWorker(location, moduleReferenceExpression, ignoreErrors ? undefined : errorMessage, ignoreErrors);
}
- function resolveExternalModuleNameWorker(location: Node, moduleReferenceExpression: Expression, moduleNotFoundError: DiagnosticMessage | undefined, isForAugmentation = false): Symbol | undefined {
+ function resolveExternalModuleNameWorker(location: Node, moduleReferenceExpression: Expression, moduleNotFoundError: DiagnosticMessage | undefined, ignoreErrors = false, isForAugmentation = false): Symbol | undefined {
return isStringLiteralLike(moduleReferenceExpression)
- ? resolveExternalModule(location, moduleReferenceExpression.text, moduleNotFoundError, moduleReferenceExpression, isForAugmentation)
+ ? resolveExternalModule(location, moduleReferenceExpression.text, moduleNotFoundError, !ignoreErrors ? moduleReferenceExpression : undefined, isForAugmentation)
: undefined;
}
- function resolveExternalModule(location: Node, moduleReference: string, moduleNotFoundError: DiagnosticMessage | undefined, errorNode: Node, isForAugmentation = false): Symbol | undefined {
- if (startsWith(moduleReference, "@types/")) {
+ function resolveExternalModule(location: Node, moduleReference: string, moduleNotFoundError: DiagnosticMessage | undefined, errorNode: Node | undefined, isForAugmentation = false): Symbol | undefined {
+ if (errorNode && startsWith(moduleReference, "@types/")) {
const diag = Diagnostics.Cannot_import_type_declaration_files_Consider_importing_0_instead_of_1;
const withoutAtTypePrefix = removePrefix(moduleReference, "@types/");
error(errorNode, diag, withoutAtTypePrefix, moduleReference);
@@ -4581,7 +4581,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
const mode = contextSpecifier && isStringLiteralLike(contextSpecifier) ? host.getModeForUsageLocation(currentSourceFile, contextSpecifier) : currentSourceFile.impliedNodeFormat;
const moduleResolutionKind = getEmitModuleResolutionKind(compilerOptions);
const resolvedModule = host.getResolvedModule(currentSourceFile, moduleReference, mode)?.resolvedModule;
- const resolutionDiagnostic = resolvedModule && getResolutionDiagnostic(compilerOptions, resolvedModule, currentSourceFile);
+ const resolutionDiagnostic = errorNode && resolvedModule && getResolutionDiagnostic(compilerOptions, resolvedModule, currentSourceFile);
const sourceFile = resolvedModule
&& (!resolutionDiagnostic || resolutionDiagnostic === Diagnostics.Module_0_was_resolved_to_1_but_jsx_is_not_set)
&& host.getSourceFile(resolvedModule.resolvedFileName);
@@ -4594,7 +4594,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
if (resolvedModule.resolvedUsingTsExtension && isDeclarationFileName(moduleReference)) {
const importOrExport = findAncestor(location, isImportDeclaration)?.importClause ||
findAncestor(location, or(isImportEqualsDeclaration, isExportDeclaration));
- if (importOrExport && !importOrExport.isTypeOnly || findAncestor(location, isImportCall)) {
+ if (errorNode && importOrExport && !importOrExport.isTypeOnly || findAncestor(location, isImportCall)) {
error(
errorNode,
Diagnostics.A_declaration_file_cannot_be_imported_without_import_type_Did_you_mean_to_import_an_implementation_file_0_instead,
@@ -4605,17 +4605,17 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
else if (resolvedModule.resolvedUsingTsExtension && !shouldAllowImportingTsExtension(compilerOptions, currentSourceFile.fileName)) {
const importOrExport = findAncestor(location, isImportDeclaration)?.importClause ||
findAncestor(location, or(isImportEqualsDeclaration, isExportDeclaration));
- if (!(importOrExport?.isTypeOnly || findAncestor(location, isImportTypeNode))) {
+ if (errorNode && !(importOrExport?.isTypeOnly || findAncestor(location, isImportTypeNode))) {
const tsExtension = Debug.checkDefined(tryExtractTSExtension(moduleReference));
error(errorNode, Diagnostics.An_import_path_can_only_end_with_a_0_extension_when_allowImportingTsExtensions_is_enabled, tsExtension);
}
}
if (sourceFile.symbol) {
- if (resolvedModule.isExternalLibraryImport && !resolutionExtensionIsTSOrJson(resolvedModule.extension)) {
+ if (errorNode && resolvedModule.isExternalLibraryImport && !resolutionExtensionIsTSOrJson(resolvedModule.extension)) {
errorOnImplicitAnyModule(/*isError*/ false, errorNode, currentSourceFile, mode, resolvedModule, moduleReference);
}
- if (moduleResolutionKind === ModuleResolutionKind.Node16 || moduleResolutionKind === ModuleResolutionKind.NodeNext) {
+ if (errorNode && (moduleResolutionKind === ModuleResolutionKind.Node16 || moduleResolutionKind === ModuleResolutionKind.NodeNext)) {
const isSyncImport = (currentSourceFile.impliedNodeFormat === ModuleKind.CommonJS && !findAncestor(location, isImportCall)) || !!findAncestor(location, isImportEqualsDeclaration);
const overrideHost = findAncestor(location, l => isImportTypeNode(l) || isExportDeclaration(l) || isImportDeclaration(l));
// An override clause will take effect for type-only imports and import types, and allows importing the types across formats, regardless of
@@ -4680,7 +4680,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
// merged symbol is module declaration symbol combined with all augmentations
return getMergedSymbol(sourceFile.symbol);
}
- if (moduleNotFoundError) {
+ if (errorNode && moduleNotFoundError) {
// report errors only if it was requested
error(errorNode, Diagnostics.File_0_is_not_a_module, sourceFile.fileName);
}
@@ -4702,6 +4702,10 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
}
}
+ if (!errorNode) {
+ return undefined;
+ }
+
// May be an untyped module. If so, ignore resolutionDiagnostic.
if (resolvedModule && !resolutionExtensionIsTSOrJson(resolvedModule.extension) && resolutionDiagnostic === undefined || resolutionDiagnostic === Diagnostics.Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type) {
if (isForAugmentation) {
@@ -33078,7 +33082,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
? Diagnostics.Cannot_find_module_0_Did_you_mean_to_set_the_moduleResolution_option_to_nodenext_or_to_add_aliases_to_the_paths_option
: Diagnostics.Cannot_find_module_0_or_its_corresponding_type_declarations;
const specifier = getJSXRuntimeImportSpecifier(file, runtimeImportSpecifier);
- const mod = resolveExternalModule(specifier || location!, runtimeImportSpecifier, errorMessage, location!);
+ const mod = resolveExternalModule(specifier || location!, runtimeImportSpecifier, errorMessage, location);
const result = mod && mod !== unknownSymbol ? getMergedSymbol(resolveSymbol(mod)) : undefined;
if (links) {
links.jsxImplicitImportContainer = result || false;
diff --git a/src/testRunner/unittests/tsc/composite.ts b/src/testRunner/unittests/tsc/composite.ts
index 0a9dbfb7de6ff..b2d29ef5fbbea 100644
--- a/src/testRunner/unittests/tsc/composite.ts
+++ b/src/testRunner/unittests/tsc/composite.ts
@@ -114,4 +114,58 @@ describe("unittests:: tsc:: composite::", () => {
},
],
});
+
+ verifyTsc({
+ scenario: "composite",
+ subScenario: "synthetic jsx import of ESM module from CJS module no crash no jsx element",
+ fs: () =>
+ loadProjectFromFiles({
+ "/src/main.ts": "export default 42;",
+ "/tsconfig.json": jsonToReadableText({
+ compilerOptions: {
+ composite: true,
+ module: "Node16",
+ jsx: "react-jsx",
+ jsxImportSource: "solid-js",
+ },
+ }),
+ "/node_modules/solid-js/package.json": jsonToReadableText({
+ name: "solid-js",
+ type: "module",
+ }),
+ "/node_modules/solid-js/jsx-runtime.d.ts": Utils.dedent`
+ export namespace JSX {
+ type IntrinsicElements = { div: {}; };
+ }
+ `,
+ }),
+ commandLineArgs: [],
+ });
+
+ verifyTsc({
+ scenario: "composite",
+ subScenario: "synthetic jsx import of ESM module from CJS module error on jsx element",
+ fs: () =>
+ loadProjectFromFiles({
+ "/src/main.tsx": "export default
;",
+ "/tsconfig.json": jsonToReadableText({
+ compilerOptions: {
+ composite: true,
+ module: "Node16",
+ jsx: "react-jsx",
+ jsxImportSource: "solid-js",
+ },
+ }),
+ "/node_modules/solid-js/package.json": jsonToReadableText({
+ name: "solid-js",
+ type: "module",
+ }),
+ "/node_modules/solid-js/jsx-runtime.d.ts": Utils.dedent`
+ export namespace JSX {
+ type IntrinsicElements = { div: {}; };
+ }
+ `,
+ }),
+ commandLineArgs: [],
+ });
});
diff --git a/src/testRunner/unittests/tscWatch/programUpdates.ts b/src/testRunner/unittests/tscWatch/programUpdates.ts
index 600a45563b4a8..626367c7f3084 100644
--- a/src/testRunner/unittests/tscWatch/programUpdates.ts
+++ b/src/testRunner/unittests/tscWatch/programUpdates.ts
@@ -2164,6 +2164,48 @@ import { x } from "../b";`,
],
});
+ verifyTscWatch({
+ scenario,
+ subScenario: "when changing `allowImportingTsExtensions` of config file 2",
+ commandLineArgs: ["-w", "-p", ".", "--extendedDiagnostics"],
+ sys: () => {
+ const module1: File = {
+ path: `/user/username/projects/myproject/a.ts`,
+ content: `export const foo = 10;`,
+ };
+ const module2: File = {
+ path: `/user/username/projects/myproject/b.ts`,
+ content: `export * as a from "./a.ts";`,
+ };
+ const config: File = {
+ path: `/user/username/projects/myproject/tsconfig.json`,
+ content: jsonToReadableText({
+ compilerOptions: {
+ noEmit: true,
+ allowImportingTsExtensions: false,
+ },
+ }),
+ };
+ return createWatchedSystem([module1, module2, config, libFile], { currentDirectory: "/user/username/projects/myproject" });
+ },
+ edits: [
+ {
+ caption: "Change allowImportingTsExtensions to true",
+ edit: sys =>
+ sys.writeFile(
+ `/user/username/projects/myproject/tsconfig.json`,
+ jsonToReadableText({
+ compilerOptions: {
+ noEmit: true,
+ allowImportingTsExtensions: true,
+ },
+ }),
+ ),
+ timeouts: sys => sys.runQueuedTimeoutCallbacks(),
+ },
+ ],
+ });
+
verifyTscWatch({
scenario,
subScenario: "when changing checkJs of config file",
diff --git a/tests/baselines/reference/tsc/composite/synthetic-jsx-import-of-ESM-module-from-CJS-module-error-on-jsx-element.js b/tests/baselines/reference/tsc/composite/synthetic-jsx-import-of-ESM-module-from-CJS-module-error-on-jsx-element.js
new file mode 100644
index 0000000000000..44f24369bccc2
--- /dev/null
+++ b/tests/baselines/reference/tsc/composite/synthetic-jsx-import-of-ESM-module-from-CJS-module-error-on-jsx-element.js
@@ -0,0 +1,168 @@
+currentDirectory:: / useCaseSensitiveFileNames: false
+Input::
+//// [/lib/lib.d.ts]
+///
+interface Boolean {}
+interface Function {}
+interface CallableFunction {}
+interface NewableFunction {}
+interface IArguments {}
+interface Number { toExponential: any; }
+interface Object {}
+interface RegExp {}
+interface String { charAt: any; }
+interface Array { length: number; [n: number]: T; }
+interface ReadonlyArray {}
+declare const console: { log(msg: any): void; };
+
+//// [/node_modules/solid-js/jsx-runtime.d.ts]
+export namespace JSX {
+ type IntrinsicElements = { div: {}; };
+}
+
+
+//// [/node_modules/solid-js/package.json]
+{
+ "name": "solid-js",
+ "type": "module"
+}
+
+//// [/src/main.tsx]
+export default ;
+
+//// [/tsconfig.json]
+{
+ "compilerOptions": {
+ "composite": true,
+ "module": "Node16",
+ "jsx": "react-jsx",
+ "jsxImportSource": "solid-js"
+ }
+}
+
+
+
+Output::
+/lib/tsc
+[96msrc/main.tsx[0m:[93m1[0m:[93m16[0m - [91merror[0m[90m TS1479: [0mThe current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("solid-js/jsx-runtime")' call instead.
+ To convert this file to an ECMAScript module, create a local package.json file with `{ "type": "module" }`.
+
+[7m1[0m export default ;
+[7m [0m [91m ~~~~~~[0m
+
+
+Found 1 error in src/main.tsx[90m:1[0m
+
+exitCode:: ExitStatus.DiagnosticsPresent_OutputsGenerated
+
+
+//// [/src/main.d.ts]
+declare const _default: any;
+export default _default;
+
+
+//// [/src/main.js]
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+const jsx_runtime_1 = require("solid-js/jsx-runtime");
+exports.default = (0, jsx_runtime_1.jsx)("div", {});
+
+
+//// [/tsconfig.tsbuildinfo]
+{"fileNames":["./lib/lib.d.ts","./node_modules/solid-js/jsx-runtime.d.ts","./src/main.tsx"],"fileIdsList":[[2]],"fileInfos":[{"version":"3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedFormat":1},{"version":"-3511680495-export namespace JSX {\n type IntrinsicElements = { div: {}; };\n}\n","impliedFormat":99},{"version":"-359851309-export default ;","signature":"2119670487-declare const _default: any;\nexport default _default;\n","impliedFormat":1}],"root":[1,3],"options":{"composite":true,"jsx":4,"jsxImportSource":"solid-js","module":100},"referencedMap":[[3,1]],"semanticDiagnosticsPerFile":[[3,[{"start":15,"length":6,"code":1479,"category":1,"messageText":{"messageText":"The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import(\"solid-js/jsx-runtime\")' call instead.","category":1,"code":1479,"next":[{"messageText":"To convert this file to an ECMAScript module, create a local package.json file with `{ \"type\": \"module\" }`.","category":3,"code":1483}]}}]]],"latestChangedDtsFile":"./src/main.d.ts","version":"FakeTSVersion"}
+
+//// [/tsconfig.tsbuildinfo.readable.baseline.txt]
+{
+ "fileNames": [
+ "./lib/lib.d.ts",
+ "./node_modules/solid-js/jsx-runtime.d.ts",
+ "./src/main.tsx"
+ ],
+ "fileIdsList": [
+ [
+ "./node_modules/solid-js/jsx-runtime.d.ts"
+ ]
+ ],
+ "fileInfos": {
+ "./lib/lib.d.ts": {
+ "original": {
+ "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };",
+ "affectsGlobalScope": true,
+ "impliedFormat": 1
+ },
+ "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };",
+ "signature": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };",
+ "affectsGlobalScope": true,
+ "impliedFormat": "commonjs"
+ },
+ "./node_modules/solid-js/jsx-runtime.d.ts": {
+ "original": {
+ "version": "-3511680495-export namespace JSX {\n type IntrinsicElements = { div: {}; };\n}\n",
+ "impliedFormat": 99
+ },
+ "version": "-3511680495-export namespace JSX {\n type IntrinsicElements = { div: {}; };\n}\n",
+ "signature": "-3511680495-export namespace JSX {\n type IntrinsicElements = { div: {}; };\n}\n",
+ "impliedFormat": "esnext"
+ },
+ "./src/main.tsx": {
+ "original": {
+ "version": "-359851309-export default ;",
+ "signature": "2119670487-declare const _default: any;\nexport default _default;\n",
+ "impliedFormat": 1
+ },
+ "version": "-359851309-export default ;",
+ "signature": "2119670487-declare const _default: any;\nexport default _default;\n",
+ "impliedFormat": "commonjs"
+ }
+ },
+ "root": [
+ [
+ 1,
+ "./lib/lib.d.ts"
+ ],
+ [
+ 3,
+ "./src/main.tsx"
+ ]
+ ],
+ "options": {
+ "composite": true,
+ "jsx": 4,
+ "jsxImportSource": "solid-js",
+ "module": 100
+ },
+ "referencedMap": {
+ "./src/main.tsx": [
+ "./node_modules/solid-js/jsx-runtime.d.ts"
+ ]
+ },
+ "semanticDiagnosticsPerFile": [
+ [
+ "./src/main.tsx",
+ [
+ {
+ "start": 15,
+ "length": 6,
+ "code": 1479,
+ "category": 1,
+ "messageText": {
+ "messageText": "The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import(\"solid-js/jsx-runtime\")' call instead.",
+ "category": 1,
+ "code": 1479,
+ "next": [
+ {
+ "messageText": "To convert this file to an ECMAScript module, create a local package.json file with `{ \"type\": \"module\" }`.",
+ "category": 3,
+ "code": 1483
+ }
+ ]
+ }
+ }
+ ]
+ ]
+ ],
+ "latestChangedDtsFile": "./src/main.d.ts",
+ "version": "FakeTSVersion",
+ "size": 1628
+}
+
diff --git a/tests/baselines/reference/tsc/composite/synthetic-jsx-import-of-ESM-module-from-CJS-module-no-crash-no-jsx-element.js b/tests/baselines/reference/tsc/composite/synthetic-jsx-import-of-ESM-module-from-CJS-module-no-crash-no-jsx-element.js
new file mode 100644
index 0000000000000..e0f89bcede680
--- /dev/null
+++ b/tests/baselines/reference/tsc/composite/synthetic-jsx-import-of-ESM-module-from-CJS-module-no-crash-no-jsx-element.js
@@ -0,0 +1,133 @@
+currentDirectory:: / useCaseSensitiveFileNames: false
+Input::
+//// [/lib/lib.d.ts]
+///
+interface Boolean {}
+interface Function {}
+interface CallableFunction {}
+interface NewableFunction {}
+interface IArguments {}
+interface Number { toExponential: any; }
+interface Object {}
+interface RegExp {}
+interface String { charAt: any; }
+interface Array { length: number; [n: number]: T; }
+interface ReadonlyArray {}
+declare const console: { log(msg: any): void; };
+
+//// [/node_modules/solid-js/jsx-runtime.d.ts]
+export namespace JSX {
+ type IntrinsicElements = { div: {}; };
+}
+
+
+//// [/node_modules/solid-js/package.json]
+{
+ "name": "solid-js",
+ "type": "module"
+}
+
+//// [/src/main.ts]
+export default 42;
+
+//// [/tsconfig.json]
+{
+ "compilerOptions": {
+ "composite": true,
+ "module": "Node16",
+ "jsx": "react-jsx",
+ "jsxImportSource": "solid-js"
+ }
+}
+
+
+
+Output::
+/lib/tsc
+exitCode:: ExitStatus.Success
+
+
+//// [/src/main.d.ts]
+declare const _default: 42;
+export default _default;
+
+
+//// [/src/main.js]
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.default = 42;
+
+
+//// [/tsconfig.tsbuildinfo]
+{"fileNames":["./lib/lib.d.ts","./node_modules/solid-js/jsx-runtime.d.ts","./src/main.ts"],"fileIdsList":[[2]],"fileInfos":[{"version":"3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedFormat":1},{"version":"-3511680495-export namespace JSX {\n type IntrinsicElements = { div: {}; };\n}\n","impliedFormat":99},{"version":"-1874019635-export default 42;","signature":"-5660511115-declare const _default: 42;\nexport default _default;\n","impliedFormat":1}],"root":[1,3],"options":{"composite":true,"jsx":4,"jsxImportSource":"solid-js","module":100},"referencedMap":[[3,1]],"latestChangedDtsFile":"./src/main.d.ts","version":"FakeTSVersion"}
+
+//// [/tsconfig.tsbuildinfo.readable.baseline.txt]
+{
+ "fileNames": [
+ "./lib/lib.d.ts",
+ "./node_modules/solid-js/jsx-runtime.d.ts",
+ "./src/main.ts"
+ ],
+ "fileIdsList": [
+ [
+ "./node_modules/solid-js/jsx-runtime.d.ts"
+ ]
+ ],
+ "fileInfos": {
+ "./lib/lib.d.ts": {
+ "original": {
+ "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };",
+ "affectsGlobalScope": true,
+ "impliedFormat": 1
+ },
+ "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };",
+ "signature": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };",
+ "affectsGlobalScope": true,
+ "impliedFormat": "commonjs"
+ },
+ "./node_modules/solid-js/jsx-runtime.d.ts": {
+ "original": {
+ "version": "-3511680495-export namespace JSX {\n type IntrinsicElements = { div: {}; };\n}\n",
+ "impliedFormat": 99
+ },
+ "version": "-3511680495-export namespace JSX {\n type IntrinsicElements = { div: {}; };\n}\n",
+ "signature": "-3511680495-export namespace JSX {\n type IntrinsicElements = { div: {}; };\n}\n",
+ "impliedFormat": "esnext"
+ },
+ "./src/main.ts": {
+ "original": {
+ "version": "-1874019635-export default 42;",
+ "signature": "-5660511115-declare const _default: 42;\nexport default _default;\n",
+ "impliedFormat": 1
+ },
+ "version": "-1874019635-export default 42;",
+ "signature": "-5660511115-declare const _default: 42;\nexport default _default;\n",
+ "impliedFormat": "commonjs"
+ }
+ },
+ "root": [
+ [
+ 1,
+ "./lib/lib.d.ts"
+ ],
+ [
+ 3,
+ "./src/main.ts"
+ ]
+ ],
+ "options": {
+ "composite": true,
+ "jsx": 4,
+ "jsxImportSource": "solid-js",
+ "module": 100
+ },
+ "referencedMap": {
+ "./src/main.ts": [
+ "./node_modules/solid-js/jsx-runtime.d.ts"
+ ]
+ },
+ "latestChangedDtsFile": "./src/main.d.ts",
+ "version": "FakeTSVersion",
+ "size": 1067
+}
+
diff --git a/tests/baselines/reference/tscWatch/programUpdates/when-changing-`allowImportingTsExtensions`-of-config-file-2.js b/tests/baselines/reference/tscWatch/programUpdates/when-changing-`allowImportingTsExtensions`-of-config-file-2.js
new file mode 100644
index 0000000000000..0e29888a74f3b
--- /dev/null
+++ b/tests/baselines/reference/tscWatch/programUpdates/when-changing-`allowImportingTsExtensions`-of-config-file-2.js
@@ -0,0 +1,175 @@
+currentDirectory:: /user/username/projects/myproject useCaseSensitiveFileNames: false
+Input::
+//// [/user/username/projects/myproject/a.ts]
+export const foo = 10;
+
+//// [/user/username/projects/myproject/b.ts]
+export * as a from "./a.ts";
+
+//// [/user/username/projects/myproject/tsconfig.json]
+{
+ "compilerOptions": {
+ "noEmit": true,
+ "allowImportingTsExtensions": false
+ }
+}
+
+//// [/a/lib/lib.d.ts]
+///
+interface Boolean {}
+interface Function {}
+interface CallableFunction {}
+interface NewableFunction {}
+interface IArguments {}
+interface Number { toExponential: any; }
+interface Object {}
+interface RegExp {}
+interface String { charAt: any; }
+interface Array { length: number; [n: number]: T; }
+
+
+/a/lib/tsc.js -w -p . --extendedDiagnostics
+Output::
+[[90mHH:MM:SS AM[0m] Starting compilation in watch mode...
+
+Current directory: /user/username/projects/myproject CaseSensitiveFileNames: false
+FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 undefined Config file
+Synchronizing program
+CreatingProgramWith::
+ roots: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"]
+ options: {"noEmit":true,"allowImportingTsExtensions":false,"watch":true,"project":"/user/username/projects/myproject","extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"}
+FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/a.ts 250 undefined Source file
+FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 250 undefined Source file
+FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 250 undefined Source file
+DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 undefined Type roots
+Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 undefined Type roots
+DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/node_modules/@types 1 undefined Type roots
+Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/node_modules/@types 1 undefined Type roots
+[96mb.ts[0m:[93m1[0m:[93m20[0m - [91merror[0m[90m TS5097: [0mAn import path can only end with a '.ts' extension when 'allowImportingTsExtensions' is enabled.
+
+[7m1[0m export * as a from "./a.ts";
+[7m [0m [91m ~~~~~~~~[0m
+
+[[90mHH:MM:SS AM[0m] Found 1 error. Watching for file changes.
+
+DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 undefined Wild card directory
+Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 undefined Wild card directory
+
+
+
+PolledWatches::
+/user/username/projects/myproject/node_modules/@types: *new*
+ {"pollingInterval":500}
+/user/username/projects/node_modules/@types: *new*
+ {"pollingInterval":500}
+
+FsWatches::
+/a/lib/lib.d.ts: *new*
+ {}
+/user/username/projects/myproject/a.ts: *new*
+ {}
+/user/username/projects/myproject/b.ts: *new*
+ {}
+/user/username/projects/myproject/tsconfig.json: *new*
+ {}
+
+FsWatchesRecursive::
+/user/username/projects/myproject: *new*
+ {}
+
+Program root files: [
+ "/user/username/projects/myproject/a.ts",
+ "/user/username/projects/myproject/b.ts"
+]
+Program options: {
+ "noEmit": true,
+ "allowImportingTsExtensions": false,
+ "watch": true,
+ "project": "/user/username/projects/myproject",
+ "extendedDiagnostics": true,
+ "configFilePath": "/user/username/projects/myproject/tsconfig.json"
+}
+Program structureReused: Not
+Program files::
+/a/lib/lib.d.ts
+/user/username/projects/myproject/a.ts
+/user/username/projects/myproject/b.ts
+
+Semantic diagnostics in builder refreshed for::
+/a/lib/lib.d.ts
+/user/username/projects/myproject/a.ts
+/user/username/projects/myproject/b.ts
+
+Shape signatures in builder refreshed for::
+/a/lib/lib.d.ts (used version)
+/user/username/projects/myproject/a.ts (used version)
+/user/username/projects/myproject/b.ts (used version)
+
+exitCode:: ExitStatus.undefined
+
+Change:: Change allowImportingTsExtensions to true
+
+Input::
+//// [/user/username/projects/myproject/tsconfig.json]
+{
+ "compilerOptions": {
+ "noEmit": true,
+ "allowImportingTsExtensions": true
+ }
+}
+
+
+Output::
+FileWatcher:: Triggered with /user/username/projects/myproject/tsconfig.json 1:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 undefined Config file
+Scheduling update
+Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/tsconfig.json 1:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 undefined Config file
+
+
+Timeout callback:: count: 1
+1: timerToUpdateProgram *new*
+
+Before running Timeout callback:: count: 1
+1: timerToUpdateProgram
+
+Host is moving to new time
+After running Timeout callback:: count: 0
+Output::
+Reloading config file: /user/username/projects/myproject/tsconfig.json
+Synchronizing program
+[[90mHH:MM:SS AM[0m] File change detected. Starting incremental compilation...
+
+CreatingProgramWith::
+ roots: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"]
+ options: {"noEmit":true,"allowImportingTsExtensions":true,"watch":true,"project":"/user/username/projects/myproject","extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"}
+[[90mHH:MM:SS AM[0m] Found 0 errors. Watching for file changes.
+
+
+
+
+
+Program root files: [
+ "/user/username/projects/myproject/a.ts",
+ "/user/username/projects/myproject/b.ts"
+]
+Program options: {
+ "noEmit": true,
+ "allowImportingTsExtensions": true,
+ "watch": true,
+ "project": "/user/username/projects/myproject",
+ "extendedDiagnostics": true,
+ "configFilePath": "/user/username/projects/myproject/tsconfig.json"
+}
+Program structureReused: Completely
+Program files::
+/a/lib/lib.d.ts
+/user/username/projects/myproject/a.ts
+/user/username/projects/myproject/b.ts
+
+Semantic diagnostics in builder refreshed for::
+/a/lib/lib.d.ts
+/user/username/projects/myproject/a.ts
+/user/username/projects/myproject/b.ts
+
+No shapes updated in the builder::
+
+exitCode:: ExitStatus.undefined
diff --git a/tests/baselines/reference/tscWatch/programUpdates/when-changing-`allowImportingTsExtensions`-of-config-file.js b/tests/baselines/reference/tscWatch/programUpdates/when-changing-`allowImportingTsExtensions`-of-config-file.js
index f3305c75856fc..36f08a5023ffd 100644
--- a/tests/baselines/reference/tscWatch/programUpdates/when-changing-`allowImportingTsExtensions`-of-config-file.js
+++ b/tests/baselines/reference/tscWatch/programUpdates/when-changing-`allowImportingTsExtensions`-of-config-file.js
@@ -45,12 +45,7 @@ DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_mod
Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 undefined Type roots
DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/node_modules/@types 1 undefined Type roots
Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/node_modules/@types 1 undefined Type roots
-[96mb.ts[0m:[93m1[0m:[93m8[0m - [91merror[0m[90m TS5097: [0mAn import path can only end with a '.ts' extension when 'allowImportingTsExtensions' is enabled.
-
-[7m1[0m import "./a.ts";
-[7m [0m [91m ~~~~~~~~[0m
-
-[[90mHH:MM:SS AM[0m] Found 1 error. Watching for file changes.
+[[90mHH:MM:SS AM[0m] Found 0 errors. Watching for file changes.
DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 undefined Wild card directory
Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 undefined Wild card directory
diff --git a/tests/baselines/reference/tscWatch/resolveJsonModule/incremental-always-prefers-declaration-file-over-document.js b/tests/baselines/reference/tscWatch/resolveJsonModule/incremental-always-prefers-declaration-file-over-document.js
index fa68de362541c..cf7e08090f750 100644
--- a/tests/baselines/reference/tscWatch/resolveJsonModule/incremental-always-prefers-declaration-file-over-document.js
+++ b/tests/baselines/reference/tscWatch/resolveJsonModule/incremental-always-prefers-declaration-file-over-document.js
@@ -52,7 +52,7 @@ var x = data_json_1.default;
//// [/src/project/tsconfig.tsbuildinfo]
-{"fileNames":["../../a/lib/lib.d.ts","./data.d.json.ts","./main.ts"],"fileInfos":[{"version":"-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }","affectsGlobalScope":true},"2718060498-declare var val: string; export default val;","6961905452-import data from \"./data.json\"; let x: string = data;"],"root":[2,3],"semanticDiagnosticsPerFile":[[3,[{"start":17,"length":13,"messageText":"Module './data.json' was resolved to '/src/project/data.d.json.ts', but '--allowArbitraryExtensions' is not set.","category":1,"code":6263}]]],"version":"FakeTSVersion"}
+{"fileNames":["../../a/lib/lib.d.ts","./data.d.json.ts","./main.ts"],"fileIdsList":[[2]],"fileInfos":[{"version":"-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }","affectsGlobalScope":true},"2718060498-declare var val: string; export default val;","6961905452-import data from \"./data.json\"; let x: string = data;"],"root":[2,3],"referencedMap":[[3,1]],"semanticDiagnosticsPerFile":[[3,[{"start":17,"length":13,"messageText":"Module './data.json' was resolved to '/src/project/data.d.json.ts', but '--allowArbitraryExtensions' is not set.","category":1,"code":6263}]]],"version":"FakeTSVersion"}
//// [/src/project/tsconfig.tsbuildinfo.readable.baseline.txt]
{
@@ -61,6 +61,11 @@ var x = data_json_1.default;
"./data.d.json.ts",
"./main.ts"
],
+ "fileIdsList": [
+ [
+ "./data.d.json.ts"
+ ]
+ ],
"fileInfos": {
"../../a/lib/lib.d.ts": {
"original": {
@@ -90,6 +95,11 @@ var x = data_json_1.default;
"./main.ts"
]
],
+ "referencedMap": {
+ "./main.ts": [
+ "./data.d.json.ts"
+ ]
+ },
"semanticDiagnosticsPerFile": [
[
"./main.ts",
@@ -105,7 +115,7 @@ var x = data_json_1.default;
]
],
"version": "FakeTSVersion",
- "size": 864
+ "size": 908
}