From 5ce22801a71571f52936fa16360a40f6870a025e Mon Sep 17 00:00:00 2001 From: Kanchalai Tanglertsampan Date: Mon, 10 Oct 2016 11:11:06 -0700 Subject: [PATCH] Port fix from PR#11268 --- src/services/navigationBar.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/services/navigationBar.ts b/src/services/navigationBar.ts index 5c8c47e9666..0397ae73229 100644 --- a/src/services/navigationBar.ts +++ b/src/services/navigationBar.ts @@ -324,7 +324,7 @@ namespace ts.NavigationBar { } // More efficient to create a collator once and use its `compare` than to call `a.localeCompare(b)` many times. - const collator: { compare(a: string, b: string): number } = typeof Intl === "undefined" ? undefined : new Intl.Collator(); + const collator: { compare(a: string, b: string): number } = typeof Intl === "object" && typeof Intl.Collator === "function" ? new Intl.Collator() : undefined; // Intl is missing in Safari, and node 0.10 treats "a" as greater than "B". const localeCompareIsCorrect = collator && collator.compare("a", "B") < 0; const localeCompareFix: (a: string, b: string) => number = localeCompareIsCorrect ? collator.compare : function(a, b) {