diff --git a/src/compiler/inspectValue.ts b/src/compiler/inspectValue.ts index 8433ee6e489..381f47d12e9 100644 --- a/src/compiler/inspectValue.ts +++ b/src/compiler/inspectValue.ts @@ -148,7 +148,7 @@ namespace ts { } export function isJsPrivate(name: string): boolean { - return name.startsWith("_"); + return startsWith(name, "_"); } function tryRequire(fileNameToRequire: string): unknown { diff --git a/src/compiler/moduleSpecifiers.ts b/src/compiler/moduleSpecifiers.ts index 1913ee90b2b..f5bac45f6ab 100644 --- a/src/compiler/moduleSpecifiers.ts +++ b/src/compiler/moduleSpecifiers.ts @@ -203,7 +203,7 @@ namespace ts.moduleSpecifiers { return; // Don't want to a package to globally import from itself } - const target = targets.find(t => compareStrings(t.slice(0, resolved.length + 1), resolved + "/") === Comparison.EqualTo); + const target = find(targets, t => compareStrings(t.slice(0, resolved.length + 1), resolved + "/") === Comparison.EqualTo); if (target === undefined) return; const relative = getRelativePathFromDirectory(resolved, target, getCanonicalFileName); diff --git a/src/services/rename.ts b/src/services/rename.ts index 7ba32c91309..a51d79797bf 100644 --- a/src/services/rename.ts +++ b/src/services/rename.ts @@ -45,7 +45,7 @@ namespace ts.Rename { const moduleSourceFile = find(moduleSymbol.declarations, isSourceFile); if (!moduleSourceFile) return undefined; - const withoutIndex = node.text.endsWith("/index") || node.text.endsWith("/index.js") ? undefined : tryRemoveSuffix(removeFileExtension(moduleSourceFile.fileName), "/index"); + const withoutIndex = endsWith(node.text, "/index") || endsWith(node.text, "/index.js") ? undefined : tryRemoveSuffix(removeFileExtension(moduleSourceFile.fileName), "/index"); const name = withoutIndex === undefined ? moduleSourceFile.fileName : withoutIndex; const kind = withoutIndex === undefined ? ScriptElementKind.moduleElement : ScriptElementKind.directory; const indexAfterLastSlash = node.text.lastIndexOf("/") + 1;