From 826ae0ed105e14d5bd28fbb6d2e2b34181295175 Mon Sep 17 00:00:00 2001 From: auvred Date: Mon, 24 Aug 2026 08:18:37 +0300 Subject: [PATCH] Avoid allocations when checking project reference declaration directories --- tsc/internal/compiler/projectreferencedtsfakinghost.go | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/tsc/internal/compiler/projectreferencedtsfakinghost.go b/tsc/internal/compiler/projectreferencedtsfakinghost.go index ac3925acb25e8..64a7671b1277e 100644 --- a/tsc/internal/compiler/projectreferencedtsfakinghost.go +++ b/tsc/internal/compiler/projectreferencedtsfakinghost.go @@ -223,13 +223,8 @@ func (fs *projectReferenceDtsFakingVfs) fileExistsIfProjectReferenceDts(file str func (fs *projectReferenceDtsFakingVfs) directoryExistsIfProjectReferenceDeclDir(dir string) core.Tristate { dirPath := fs.toPath(dir) - dirPathWithTrailingDirectorySeparator := dirPath + "/" for declDirPath := range fs.dtsDirectories.Keys() { - if dirPath == declDirPath || - // Any parent directory of declaration dir - strings.HasPrefix(string(declDirPath), string(dirPathWithTrailingDirectorySeparator)) || - // Any directory inside declaration dir - strings.HasPrefix(string(dirPath), string(declDirPath)+"/") { + if dirPath.ContainsPath(declDirPath) || declDirPath.ContainsPath(dirPath) { return core.TSTrue } }