@@ -5420,6 +5420,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
5420
5420
(result || (result = [])).push(symbol);
5421
5421
}
5422
5422
});
5423
+ result?.sort(compareSymbols);
5423
5424
return result || emptyArray;
5424
5425
}
5425
5426
@@ -34716,18 +34717,15 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
34716
34717
// So the table *contains* `x` but `x` isn't actually in scope.
34717
34718
// However, resolveNameHelper will continue and call this callback again, so we'll eventually get a correct suggestion.
34718
34719
if (symbol) return symbol;
34719
- let candidates: Symbol[] ;
34720
+ let candidates = arrayFrom(symbols.values()).sort(compareSymbols) ;
34720
34721
if (symbols === globals) {
34721
34722
const primitives = mapDefined(
34722
34723
["string", "number", "boolean", "object", "bigint", "symbol"],
34723
34724
s => symbols.has((s.charAt(0).toUpperCase() + s.slice(1)) as __String)
34724
34725
? createSymbol(SymbolFlags.TypeAlias, s as __String) as Symbol
34725
34726
: undefined,
34726
34727
);
34727
- candidates = primitives.concat(arrayFrom(symbols.values()));
34728
- }
34729
- else {
34730
- candidates = arrayFrom(symbols.values());
34728
+ candidates = concatenate(candidates, primitives);
34731
34729
}
34732
34730
return getSpellingSuggestionForName(unescapeLeadingUnderscores(name), candidates, meaning);
34733
34731
}
@@ -34738,7 +34736,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
34738
34736
}
34739
34737
34740
34738
function getSuggestedSymbolForNonexistentModule(name: Identifier, targetModule: Symbol): Symbol | undefined {
34741
- return targetModule.exports && getSpellingSuggestionForName(idText(name), getExportsOfModuleAsArray(targetModule), SymbolFlags.ModuleMember);
34739
+ return targetModule.exports && getSpellingSuggestionForName(idText(name), getExportsOfModuleAsArray(targetModule).sort(compareSymbols) , SymbolFlags.ModuleMember); // eslint-disable-line local/no-array-mutating-method-expressions
34742
34740
}
34743
34741
34744
34742
function getSuggestionForNonexistentIndexSignature(objectType: Type, expr: ElementAccessExpression, keyedType: Type): string | undefined {
0 commit comments