We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent fe32282 commit 5ce2280Copy full SHA for 5ce2280
1 file changed
src/services/navigationBar.ts
@@ -324,7 +324,7 @@ namespace ts.NavigationBar {
324
}
325
326
// More efficient to create a collator once and use its `compare` than to call `a.localeCompare(b)` many times.
327
- 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;
328
// Intl is missing in Safari, and node 0.10 treats "a" as greater than "B".
329
const localeCompareIsCorrect = collator && collator.compare("a", "B") < 0;
330
const localeCompareFix: (a: string, b: string) => number = localeCompareIsCorrect ? collator.compare : function(a, b) {
0 commit comments