From 5f5f26ba2933fd3164a458cf15c7b833d789021d Mon Sep 17 00:00:00 2001 From: Jerry Hu <4749863+jerry2013@users.noreply.github.com> Date: Wed, 27 Nov 2024 18:10:46 -0500 Subject: [PATCH 1/2] prevent vscode from constantly restarting tsserver --- src/compiler/resolutionCache.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/compiler/resolutionCache.ts b/src/compiler/resolutionCache.ts index 7c69055ec1f66..2590461b02158 100644 --- a/src/compiler/resolutionCache.ts +++ b/src/compiler/resolutionCache.ts @@ -1375,7 +1375,8 @@ export function createResolutionCache(resolutionHost: ResolutionCacheHost, rootD filePath: Path, getResolutionWithResolvedFileName: GetResolutionWithResolvedFileName, ) { - Debug.checkDefined(resolution.files).delete(filePath); + if (!resolution.files) return; + resolution.files.delete(filePath); if (resolution.files!.size) return; resolution.files = undefined; const resolved = getResolutionWithResolvedFileName(resolution); From 6264356c73f2ee2c9ec6a071dca4b3e6bccdf6b3 Mon Sep 17 00:00:00 2001 From: Jerry Hu <4749863+jerry2013@users.noreply.github.com> Date: Wed, 27 Nov 2024 23:33:53 -0500 Subject: [PATCH 2/2] lint --- src/compiler/resolutionCache.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/resolutionCache.ts b/src/compiler/resolutionCache.ts index 2590461b02158..ee649c6d83ffc 100644 --- a/src/compiler/resolutionCache.ts +++ b/src/compiler/resolutionCache.ts @@ -1377,7 +1377,7 @@ export function createResolutionCache(resolutionHost: ResolutionCacheHost, rootD ) { if (!resolution.files) return; resolution.files.delete(filePath); - if (resolution.files!.size) return; + if (resolution.files.size) return; resolution.files = undefined; const resolved = getResolutionWithResolvedFileName(resolution); if (resolved && resolved.resolvedFileName) {