Fix TS2878 error location reporting by adding errorNode checks

Co-authored-by: andrewbranch <3277153+andrewbranch@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2025-09-11 17:26:03 +00:00
co-authored by andrewbranch
parent 2157b942c1
commit 73a3ddafaf
4 changed files with 599 additions and 4 deletions
+5 -4
View File
@@ -4733,7 +4733,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
error(errorNode, resolutionDiagnostic, moduleReference, resolvedModule.resolvedFileName);
}
if (resolvedModule.resolvedUsingTsExtension && isDeclarationFileName(moduleReference)) {
if (errorNode && resolvedModule.resolvedUsingTsExtension && isDeclarationFileName(moduleReference)) {
const importOrExport = findAncestor(location, isImportDeclaration)?.importClause ||
findAncestor(location, or(isImportEqualsDeclaration, isExportDeclaration));
if (errorNode && importOrExport && !importOrExport.isTypeOnly || findAncestor(location, isImportCall)) {
@@ -4744,7 +4744,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
);
}
}
else if (resolvedModule.resolvedUsingTsExtension && !shouldAllowImportingTsExtension(compilerOptions, currentSourceFile.fileName)) {
else if (errorNode && resolvedModule.resolvedUsingTsExtension && !shouldAllowImportingTsExtension(compilerOptions, currentSourceFile.fileName)) {
const importOrExport = findAncestor(location, isImportDeclaration)?.importClause ||
findAncestor(location, or(isImportEqualsDeclaration, isExportDeclaration));
if (errorNode && !(importOrExport?.isTypeOnly || findAncestor(location, isImportTypeNode))) {
@@ -4752,8 +4752,9 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
error(errorNode, Diagnostics.An_import_path_can_only_end_with_a_0_extension_when_allowImportingTsExtensions_is_enabled, tsExtension);
}
}
else if (
compilerOptions.rewriteRelativeImportExtensions
else if (
errorNode
&& compilerOptions.rewriteRelativeImportExtensions
&& !(location.flags & NodeFlags.Ambient)
&& !isDeclarationFileName(moduleReference)
&& !isLiteralImportTypeNode(location)
@@ -0,0 +1,19 @@
// === Syntax and Semantic Diagnostics ===
Syntactic Diagnostics for file '/tests/cases/fourslash/server/rewriteRelativeImportExtensionsProjectReferences4.ts':
==== /tests/cases/fourslash/server/src/libs/utils/helper.ts (0 errors) ====
export function helper() { return 42; }
==== /tests/cases/fourslash/server/src/apps/main/index.ts (0 errors) ====
import { helper } from "../../libs/utils/helper.ts";
Semantic Diagnostics for file '/tests/cases/fourslash/server/rewriteRelativeImportExtensionsProjectReferences4.ts':
/tests/cases/fourslash/server/src/apps/main/index.ts(1,24): error TS2878: This import path is unsafe to rewrite because it resolves to another project, and the relative path between the projects' output files is not the same as the relative path between its input files.
==== /tests/cases/fourslash/server/src/libs/utils/helper.ts (0 errors) ====
export function helper() { return 42; }
==== /tests/cases/fourslash/server/src/apps/main/index.ts (1 errors) ====
import { helper } from "../../libs/utils/helper.ts";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2878: This import path is unsafe to rewrite because it resolves to another project, and the relative path between the projects' output files is not the same as the relative path between its input files.
@@ -0,0 +1,535 @@
Info seq [hh:mm:ss:mss] currentDirectory:: /home/src/Vscode/Projects/bin useCaseSensitiveFileNames:: false
Info seq [hh:mm:ss:mss] libs Location:: /home/src/tslibs/TS/Lib
Info seq [hh:mm:ss:mss] globalTypingsCacheLocation:: /home/src/Library/Caches/typescript
Info seq [hh:mm:ss:mss] Provided types map file "/home/src/tslibs/TS/Lib/typesMap.json" doesn't exist
//// [/home/src/tslibs/TS/Lib/lib.d.ts]
lib.d.ts-Text
//// [/home/src/tslibs/TS/Lib/lib.decorators.d.ts]
lib.decorators.d.ts-Text
//// [/home/src/tslibs/TS/Lib/lib.decorators.legacy.d.ts]
lib.decorators.legacy.d.ts-Text
//// [/tests/cases/fourslash/server/src/apps/main/index.ts]
import { helper } from "../../libs/utils/helper.ts";
//// [/tests/cases/fourslash/server/src/apps/main/tsconfig.json]
{
"extends": "../../tsconfig-base.json",
"compilerOptions": {
"rootDir": ".",
"outDir": "../../../dist/apps",
},
"references": [
{ "path": "../../libs/utils" }
]
}
//// [/tests/cases/fourslash/server/src/libs/utils/helper.ts]
export function helper() { return 42; }
//// [/tests/cases/fourslash/server/src/libs/utils/tsconfig.json]
{
"extends": "../../tsconfig-base.json",
"compilerOptions": {
"rootDir": ".",
"outDir": "../../../dist/libs",
}
}
//// [/tests/cases/fourslash/server/src/tsconfig-base.json]
{
"compilerOptions": {
"module": "nodenext",
"composite": true,
"rewriteRelativeImportExtensions": true,
}
}
Info seq [hh:mm:ss:mss] request:
{
"seq": 0,
"type": "request",
"arguments": {
"file": "/tests/cases/fourslash/server/src/tsconfig-base.json"
},
"command": "open"
}
Info seq [hh:mm:ss:mss] getConfigFileNameForFile:: File: /tests/cases/fourslash/server/src/tsconfig-base.json ProjectRootPath: undefined:: Result: undefined
Info seq [hh:mm:ss:mss] Creating InferredProject: /dev/null/inferredProject1*, currentDirectory: /tests/cases/fourslash/server/src
Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /tests/cases/fourslash/server/src/tsconfig.json 2000 undefined WatchType: Config file for the inferred project root
Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /tests/cases/fourslash/server/src/jsconfig.json 2000 undefined WatchType: Config file for the inferred project root
Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /tests/cases/fourslash/server/tsconfig.json 2000 undefined WatchType: Config file for the inferred project root
Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /tests/cases/fourslash/server/jsconfig.json 2000 undefined WatchType: Config file for the inferred project root
Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /dev/null/inferredProject1*
Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /home/src/tslibs/TS/Lib/lib.d.ts 500 undefined WatchType: Closed Script info
Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /home/src/tslibs/TS/Lib/lib.decorators.d.ts 500 undefined WatchType: Closed Script info
Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /home/src/tslibs/TS/Lib/lib.decorators.legacy.d.ts 500 undefined WatchType: Closed Script info
Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /tests/cases/fourslash/server/src/node_modules/@types 1 undefined Project: /dev/null/inferredProject1* WatchType: Type roots
Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /tests/cases/fourslash/server/src/node_modules/@types 1 undefined Project: /dev/null/inferredProject1* WatchType: Type roots
Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /tests/cases/fourslash/server/node_modules/@types 1 undefined Project: /dev/null/inferredProject1* WatchType: Type roots
Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /tests/cases/fourslash/server/node_modules/@types 1 undefined Project: /dev/null/inferredProject1* WatchType: Type roots
Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /tests/cases/fourslash/node_modules/@types 1 undefined Project: /dev/null/inferredProject1* WatchType: Type roots
Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /tests/cases/fourslash/node_modules/@types 1 undefined Project: /dev/null/inferredProject1* WatchType: Type roots
Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /dev/null/inferredProject1* projectStateVersion: 1 projectProgramVersion: 0 structureChanged: true structureIsReused:: Not Elapsed:: *ms
Info seq [hh:mm:ss:mss] Project '/dev/null/inferredProject1*' (Inferred)
Info seq [hh:mm:ss:mss] Files (4)
/home/src/tslibs/TS/Lib/lib.d.ts Text-1 lib.d.ts-Text
/home/src/tslibs/TS/Lib/lib.decorators.d.ts Text-1 lib.decorators.d.ts-Text
/home/src/tslibs/TS/Lib/lib.decorators.legacy.d.ts Text-1 lib.decorators.legacy.d.ts-Text
/tests/cases/fourslash/server/src/tsconfig-base.json SVC-1-0 "{\n \"compilerOptions\": {\n \"module\": \"nodenext\",\n \"composite\": true,\n \"rewriteRelativeImportExtensions\": true,\n }\n}"
../../../../../home/src/tslibs/TS/Lib/lib.d.ts
Default library for target 'es5'
../../../../../home/src/tslibs/TS/Lib/lib.decorators.d.ts
Library referenced via 'decorators' from file '../../../../../home/src/tslibs/TS/Lib/lib.d.ts'
../../../../../home/src/tslibs/TS/Lib/lib.decorators.legacy.d.ts
Library referenced via 'decorators.legacy' from file '../../../../../home/src/tslibs/TS/Lib/lib.d.ts'
tsconfig-base.json
Root file specified for compilation
Info seq [hh:mm:ss:mss] -----------------------------------------------
Info seq [hh:mm:ss:mss] Project '/dev/null/inferredProject1*' (Inferred)
Info seq [hh:mm:ss:mss] Files (4)
Info seq [hh:mm:ss:mss] -----------------------------------------------
Info seq [hh:mm:ss:mss] Open files:
Info seq [hh:mm:ss:mss] FileName: /tests/cases/fourslash/server/src/tsconfig-base.json ProjectRootPath: undefined
Info seq [hh:mm:ss:mss] Projects: /dev/null/inferredProject1*
Info seq [hh:mm:ss:mss] response:
{
"seq": 0,
"type": "response",
"command": "open",
"request_seq": 0,
"success": true,
"performanceData": {
"updateGraphDurationMs": *
}
}
After Request
watchedFiles::
/home/src/tslibs/TS/Lib/lib.d.ts: *new*
{"pollingInterval":500}
/home/src/tslibs/TS/Lib/lib.decorators.d.ts: *new*
{"pollingInterval":500}
/home/src/tslibs/TS/Lib/lib.decorators.legacy.d.ts: *new*
{"pollingInterval":500}
/tests/cases/fourslash/server/jsconfig.json: *new*
{"pollingInterval":2000}
/tests/cases/fourslash/server/src/jsconfig.json: *new*
{"pollingInterval":2000}
/tests/cases/fourslash/server/src/tsconfig.json: *new*
{"pollingInterval":2000}
/tests/cases/fourslash/server/tsconfig.json: *new*
{"pollingInterval":2000}
watchedDirectoriesRecursive::
/tests/cases/fourslash/node_modules/@types: *new*
{}
/tests/cases/fourslash/server/node_modules/@types: *new*
{}
/tests/cases/fourslash/server/src/node_modules/@types: *new*
{}
Projects::
/dev/null/inferredProject1* (Inferred) *new*
projectStateVersion: 1
projectProgramVersion: 1
autoImportProviderHost: false
ScriptInfos::
/home/src/tslibs/TS/Lib/lib.d.ts *new*
version: Text-1
containingProjects: 1
/dev/null/inferredProject1*
/home/src/tslibs/TS/Lib/lib.decorators.d.ts *new*
version: Text-1
containingProjects: 1
/dev/null/inferredProject1*
/home/src/tslibs/TS/Lib/lib.decorators.legacy.d.ts *new*
version: Text-1
containingProjects: 1
/dev/null/inferredProject1*
/tests/cases/fourslash/server/src/tsconfig-base.json (Open) *new*
version: SVC-1-0
containingProjects: 1
/dev/null/inferredProject1* *default*
Info seq [hh:mm:ss:mss] request:
{
"seq": 1,
"type": "request",
"arguments": {
"file": "/tests/cases/fourslash/server/src/apps/main/index.ts"
},
"command": "open"
}
Info seq [hh:mm:ss:mss] getConfigFileNameForFile:: File: /tests/cases/fourslash/server/src/apps/main/index.ts ProjectRootPath: undefined:: Result: /tests/cases/fourslash/server/src/apps/main/tsconfig.json
Info seq [hh:mm:ss:mss] Creating ConfiguredProject: /tests/cases/fourslash/server/src/apps/main/tsconfig.json, currentDirectory: /tests/cases/fourslash/server/src/apps/main
Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /tests/cases/fourslash/server/src/apps/main/tsconfig.json 2000 undefined Project: /tests/cases/fourslash/server/src/apps/main/tsconfig.json WatchType: Config file
Info seq [hh:mm:ss:mss] Config: /tests/cases/fourslash/server/src/apps/main/tsconfig.json : {
"rootNames": [
"/tests/cases/fourslash/server/src/apps/main/index.ts"
],
"options": {
"module": 199,
"composite": true,
"rewriteRelativeImportExtensions": true,
"rootDir": "/tests/cases/fourslash/server/src/apps/main",
"outDir": "/tests/cases/fourslash/server/dist/apps",
"configFilePath": "/tests/cases/fourslash/server/src/apps/main/tsconfig.json"
},
"projectReferences": [
{
"path": "/tests/cases/fourslash/server/src/libs/utils",
"originalPath": "../../libs/utils"
}
]
}
Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /tests/cases/fourslash/server/src/tsconfig-base.json 2000 undefined Config: /tests/cases/fourslash/server/src/apps/main/tsconfig.json WatchType: Extended config file
Info seq [hh:mm:ss:mss] event:
{
"seq": 0,
"type": "event",
"event": "projectLoadingStart",
"body": {
"projectName": "/tests/cases/fourslash/server/src/apps/main/tsconfig.json",
"reason": "Creating possible configured project for /tests/cases/fourslash/server/src/apps/main/index.ts to open"
}
}
Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /tests/cases/fourslash/server/src/apps/main 1 undefined Config: /tests/cases/fourslash/server/src/apps/main/tsconfig.json WatchType: Wild card directory
Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /tests/cases/fourslash/server/src/apps/main 1 undefined Config: /tests/cases/fourslash/server/src/apps/main/tsconfig.json WatchType: Wild card directory
Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /tests/cases/fourslash/server/src/apps/main/tsconfig.json
Info seq [hh:mm:ss:mss] Config: /tests/cases/fourslash/server/src/libs/utils/tsconfig.json : {
"rootNames": [
"/tests/cases/fourslash/server/src/libs/utils/helper.ts"
],
"options": {
"module": 199,
"composite": true,
"rewriteRelativeImportExtensions": true,
"rootDir": "/tests/cases/fourslash/server/src/libs/utils",
"outDir": "/tests/cases/fourslash/server/dist/libs",
"configFilePath": "/tests/cases/fourslash/server/src/libs/utils/tsconfig.json"
}
}
Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /tests/cases/fourslash/server/src/libs/utils/tsconfig.json 2000 undefined Project: /tests/cases/fourslash/server/src/apps/main/tsconfig.json WatchType: Config file
Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /tests/cases/fourslash/server/src/libs/utils 1 undefined Config: /tests/cases/fourslash/server/src/libs/utils/tsconfig.json WatchType: Wild card directory
Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /tests/cases/fourslash/server/src/libs/utils 1 undefined Config: /tests/cases/fourslash/server/src/libs/utils/tsconfig.json WatchType: Wild card directory
Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /tests/cases/fourslash/server/src/libs/utils/helper.ts 500 undefined WatchType: Closed Script info
Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /tests/cases/fourslash/server/src/libs/utils/package.json 2000 undefined Project: /tests/cases/fourslash/server/src/apps/main/tsconfig.json WatchType: File location affecting resolution
Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /tests/cases/fourslash/server/src/libs/package.json 2000 undefined Project: /tests/cases/fourslash/server/src/apps/main/tsconfig.json WatchType: File location affecting resolution
Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /tests/cases/fourslash/server/src/package.json 2000 undefined Project: /tests/cases/fourslash/server/src/apps/main/tsconfig.json WatchType: File location affecting resolution
Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /tests/cases/fourslash/server/package.json 2000 undefined Project: /tests/cases/fourslash/server/src/apps/main/tsconfig.json WatchType: File location affecting resolution
Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /tests/cases/fourslash/package.json 2000 undefined Project: /tests/cases/fourslash/server/src/apps/main/tsconfig.json WatchType: File location affecting resolution
Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /tests/cases/fourslash/server/src/apps/main/package.json 2000 undefined Project: /tests/cases/fourslash/server/src/apps/main/tsconfig.json WatchType: File location affecting resolution
Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /tests/cases/fourslash/server/src/apps/package.json 2000 undefined Project: /tests/cases/fourslash/server/src/apps/main/tsconfig.json WatchType: File location affecting resolution
Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /home/src/tslibs/TS/Lib/lib.esnext.full.d.ts 500 undefined Project: /tests/cases/fourslash/server/src/apps/main/tsconfig.json WatchType: Missing file
Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /tests/cases/fourslash/server/src/apps/main/node_modules/@types 1 undefined Project: /tests/cases/fourslash/server/src/apps/main/tsconfig.json WatchType: Type roots
Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /tests/cases/fourslash/server/src/apps/main/node_modules/@types 1 undefined Project: /tests/cases/fourslash/server/src/apps/main/tsconfig.json WatchType: Type roots
Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /tests/cases/fourslash/server/src/apps/node_modules/@types 1 undefined Project: /tests/cases/fourslash/server/src/apps/main/tsconfig.json WatchType: Type roots
Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /tests/cases/fourslash/server/src/apps/node_modules/@types 1 undefined Project: /tests/cases/fourslash/server/src/apps/main/tsconfig.json WatchType: Type roots
Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /tests/cases/fourslash/server/src/node_modules/@types 1 undefined Project: /tests/cases/fourslash/server/src/apps/main/tsconfig.json WatchType: Type roots
Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /tests/cases/fourslash/server/src/node_modules/@types 1 undefined Project: /tests/cases/fourslash/server/src/apps/main/tsconfig.json WatchType: Type roots
Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /tests/cases/fourslash/server/node_modules/@types 1 undefined Project: /tests/cases/fourslash/server/src/apps/main/tsconfig.json WatchType: Type roots
Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /tests/cases/fourslash/server/node_modules/@types 1 undefined Project: /tests/cases/fourslash/server/src/apps/main/tsconfig.json WatchType: Type roots
Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /tests/cases/fourslash/node_modules/@types 1 undefined Project: /tests/cases/fourslash/server/src/apps/main/tsconfig.json WatchType: Type roots
Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /tests/cases/fourslash/node_modules/@types 1 undefined Project: /tests/cases/fourslash/server/src/apps/main/tsconfig.json WatchType: Type roots
Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /tests/cases/fourslash/server/src/apps/main/tsconfig.json projectStateVersion: 1 projectProgramVersion: 0 structureChanged: true structureIsReused:: Not Elapsed:: *ms
Info seq [hh:mm:ss:mss] Project '/tests/cases/fourslash/server/src/apps/main/tsconfig.json' (Configured)
Info seq [hh:mm:ss:mss] Files (2)
/tests/cases/fourslash/server/src/libs/utils/helper.ts Text-1 "export function helper() { return 42; }"
/tests/cases/fourslash/server/src/apps/main/index.ts SVC-1-0 "import { helper } from \"../../libs/utils/helper.ts\";"
../../libs/utils/helper.ts
Imported via "../../libs/utils/helper.ts" from file 'index.ts'
File is CommonJS module because 'package.json' was not found
index.ts
Matched by default include pattern '**/*'
File is CommonJS module because 'package.json' was not found
Info seq [hh:mm:ss:mss] -----------------------------------------------
Info seq [hh:mm:ss:mss] event:
{
"seq": 0,
"type": "event",
"event": "projectLoadingFinish",
"body": {
"projectName": "/tests/cases/fourslash/server/src/apps/main/tsconfig.json"
}
}
Info seq [hh:mm:ss:mss] event:
{
"seq": 0,
"type": "event",
"event": "configFileDiag",
"body": {
"triggerFile": "/tests/cases/fourslash/server/src/apps/main/index.ts",
"configFile": "/tests/cases/fourslash/server/src/apps/main/tsconfig.json",
"diagnostics": [
{
"text": "File '/home/src/tslibs/TS/Lib/lib.esnext.full.d.ts' not found.\n The file is in the program because:\n Default library for target 'esnext'",
"code": 6053,
"category": "error"
},
{
"text": "Cannot find global type 'Array'.",
"code": 2318,
"category": "error"
},
{
"text": "Cannot find global type 'Boolean'.",
"code": 2318,
"category": "error"
},
{
"text": "Cannot find global type 'Function'.",
"code": 2318,
"category": "error"
},
{
"text": "Cannot find global type 'IArguments'.",
"code": 2318,
"category": "error"
},
{
"text": "Cannot find global type 'Number'.",
"code": 2318,
"category": "error"
},
{
"text": "Cannot find global type 'Object'.",
"code": 2318,
"category": "error"
},
{
"text": "Cannot find global type 'RegExp'.",
"code": 2318,
"category": "error"
},
{
"text": "Cannot find global type 'String'.",
"code": 2318,
"category": "error"
}
]
}
}
Info seq [hh:mm:ss:mss] getConfigFileNameForFile:: File: /tests/cases/fourslash/server/src/apps/main/tsconfig.json ProjectRootPath: undefined:: Result: undefined
Info seq [hh:mm:ss:mss] Project '/tests/cases/fourslash/server/src/apps/main/tsconfig.json' (Configured)
Info seq [hh:mm:ss:mss] Files (2)
Info seq [hh:mm:ss:mss] -----------------------------------------------
Info seq [hh:mm:ss:mss] Project '/dev/null/inferredProject1*' (Inferred)
Info seq [hh:mm:ss:mss] Files (4)
Info seq [hh:mm:ss:mss] -----------------------------------------------
Info seq [hh:mm:ss:mss] Open files:
Info seq [hh:mm:ss:mss] FileName: /tests/cases/fourslash/server/src/tsconfig-base.json ProjectRootPath: undefined
Info seq [hh:mm:ss:mss] Projects: /dev/null/inferredProject1*
Info seq [hh:mm:ss:mss] FileName: /tests/cases/fourslash/server/src/apps/main/index.ts ProjectRootPath: undefined
Info seq [hh:mm:ss:mss] Projects: /tests/cases/fourslash/server/src/apps/main/tsconfig.json
Info seq [hh:mm:ss:mss] response:
{
"seq": 0,
"type": "response",
"command": "open",
"request_seq": 1,
"success": true,
"performanceData": {
"updateGraphDurationMs": *
}
}
After Request
watchedFiles::
/home/src/tslibs/TS/Lib/lib.d.ts:
{"pollingInterval":500}
/home/src/tslibs/TS/Lib/lib.decorators.d.ts:
{"pollingInterval":500}
/home/src/tslibs/TS/Lib/lib.decorators.legacy.d.ts:
{"pollingInterval":500}
/home/src/tslibs/TS/Lib/lib.esnext.full.d.ts: *new*
{"pollingInterval":500}
/tests/cases/fourslash/package.json: *new*
{"pollingInterval":2000}
/tests/cases/fourslash/server/jsconfig.json:
{"pollingInterval":2000}
/tests/cases/fourslash/server/package.json: *new*
{"pollingInterval":2000}
/tests/cases/fourslash/server/src/apps/main/package.json: *new*
{"pollingInterval":2000}
/tests/cases/fourslash/server/src/apps/main/tsconfig.json: *new*
{"pollingInterval":2000}
/tests/cases/fourslash/server/src/apps/package.json: *new*
{"pollingInterval":2000}
/tests/cases/fourslash/server/src/jsconfig.json:
{"pollingInterval":2000}
/tests/cases/fourslash/server/src/libs/package.json: *new*
{"pollingInterval":2000}
/tests/cases/fourslash/server/src/libs/utils/helper.ts: *new*
{"pollingInterval":500}
/tests/cases/fourslash/server/src/libs/utils/package.json: *new*
{"pollingInterval":2000}
/tests/cases/fourslash/server/src/libs/utils/tsconfig.json: *new*
{"pollingInterval":2000}
/tests/cases/fourslash/server/src/package.json: *new*
{"pollingInterval":2000}
/tests/cases/fourslash/server/src/tsconfig-base.json: *new*
{"pollingInterval":2000}
/tests/cases/fourslash/server/src/tsconfig.json:
{"pollingInterval":2000}
/tests/cases/fourslash/server/tsconfig.json:
{"pollingInterval":2000}
watchedDirectoriesRecursive::
/tests/cases/fourslash/node_modules/@types:
{}
{} *new*
/tests/cases/fourslash/server/node_modules/@types:
{}
{} *new*
/tests/cases/fourslash/server/src/apps/main: *new*
{}
/tests/cases/fourslash/server/src/apps/main/node_modules/@types: *new*
{}
/tests/cases/fourslash/server/src/apps/node_modules/@types: *new*
{}
/tests/cases/fourslash/server/src/libs/utils: *new*
{}
/tests/cases/fourslash/server/src/node_modules/@types:
{}
{} *new*
Projects::
/dev/null/inferredProject1* (Inferred)
projectStateVersion: 1
projectProgramVersion: 1
autoImportProviderHost: false
/tests/cases/fourslash/server/src/apps/main/tsconfig.json (Configured) *new*
projectStateVersion: 1
projectProgramVersion: 1
autoImportProviderHost: false
ScriptInfos::
/home/src/tslibs/TS/Lib/lib.d.ts
version: Text-1
containingProjects: 1
/dev/null/inferredProject1*
/home/src/tslibs/TS/Lib/lib.decorators.d.ts
version: Text-1
containingProjects: 1
/dev/null/inferredProject1*
/home/src/tslibs/TS/Lib/lib.decorators.legacy.d.ts
version: Text-1
containingProjects: 1
/dev/null/inferredProject1*
/tests/cases/fourslash/server/src/apps/main/index.ts (Open) *new*
version: SVC-1-0
containingProjects: 1
/tests/cases/fourslash/server/src/apps/main/tsconfig.json *default*
/tests/cases/fourslash/server/src/libs/utils/helper.ts *new*
version: Text-1
containingProjects: 1
/tests/cases/fourslash/server/src/apps/main/tsconfig.json
/tests/cases/fourslash/server/src/tsconfig-base.json (Open)
version: SVC-1-0
containingProjects: 1
/dev/null/inferredProject1* *default*
Info seq [hh:mm:ss:mss] request:
{
"seq": 2,
"type": "request",
"arguments": {
"file": "/tests/cases/fourslash/server/src/libs/utils/helper.ts",
"includeLinePosition": true
},
"command": "syntacticDiagnosticsSync"
}
Info seq [hh:mm:ss:mss] response:
{
"seq": 0,
"type": "response",
"command": "syntacticDiagnosticsSync",
"request_seq": 2,
"success": true,
"body": []
}
Info seq [hh:mm:ss:mss] request:
{
"seq": 3,
"type": "request",
"arguments": {
"file": "/tests/cases/fourslash/server/src/apps/main/index.ts",
"includeLinePosition": true
},
"command": "syntacticDiagnosticsSync"
}
Info seq [hh:mm:ss:mss] response:
{
"seq": 0,
"type": "response",
"command": "syntacticDiagnosticsSync",
"request_seq": 3,
"success": true,
"body": []
}
Info seq [hh:mm:ss:mss] request:
{
"seq": 4,
"type": "request",
"arguments": {
"file": "/tests/cases/fourslash/server/src/libs/utils/helper.ts",
"includeLinePosition": true
},
"command": "semanticDiagnosticsSync"
}
Info seq [hh:mm:ss:mss] response:
{
"seq": 0,
"type": "response",
"command": "semanticDiagnosticsSync",
"request_seq": 4,
"success": true,
"body": []
}
Info seq [hh:mm:ss:mss] request:
{
"seq": 5,
"type": "request",
"arguments": {
"file": "/tests/cases/fourslash/server/src/apps/main/index.ts",
"includeLinePosition": true
},
"command": "semanticDiagnosticsSync"
}
Info seq [hh:mm:ss:mss] response:
{
"seq": 0,
"type": "response",
"command": "semanticDiagnosticsSync",
"request_seq": 5,
"success": true,
"body": [
{
"message": "This import path is unsafe to rewrite because it resolves to another project, and the relative path between the projects' output files is not the same as the relative path between its input files.",
"start": 23,
"length": 28,
"category": "error",
"code": 2878,
"startLocation": {
"line": 1,
"offset": 24
},
"endLocation": {
"line": 1,
"offset": 52
}
}
]
}
@@ -0,0 +1,40 @@
/// <reference path="../fourslash.ts" />
// @Filename: src/tsconfig-base.json
//// {
//// "compilerOptions": {
//// "module": "nodenext",
//// "composite": true,
//// "rewriteRelativeImportExtensions": true,
//// }
//// }
// @Filename: src/libs/utils/tsconfig.json
//// {
//// "extends": "../../tsconfig-base.json",
//// "compilerOptions": {
//// "rootDir": ".",
//// "outDir": "../../../dist/libs",
//// }
//// }
// @Filename: src/libs/utils/helper.ts
//// export function helper() { return 42; }
// @Filename: src/apps/main/tsconfig.json
//// {
//// "extends": "../../tsconfig-base.json",
//// "compilerOptions": {
//// "rootDir": ".",
//// "outDir": "../../../dist/apps",
//// },
//// "references": [
//// { "path": "../../libs/utils" }
//// ]
//// }
// @Filename: src/apps/main/index.ts
//// import { helper } from "../../libs/utils/helper.ts";
goTo.file("/tests/cases/fourslash/server/src/apps/main/index.ts");
verify.baselineSyntacticAndSemanticDiagnostics();