@@ -5420,6 +5420,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
54205420 (result || (result = [])).push(symbol);
54215421 }
54225422 });
5423+ result?.sort(compareSymbols);
54235424 return result || emptyArray;
54245425 }
54255426
@@ -34716,18 +34717,15 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
3471634717 // So the table *contains* `x` but `x` isn't actually in scope.
3471734718 // However, resolveNameHelper will continue and call this callback again, so we'll eventually get a correct suggestion.
3471834719 if (symbol) return symbol;
34719- let candidates: Symbol[] ;
34720+ let candidates = arrayFrom(symbols.values()).sort(compareSymbols) ;
3472034721 if (symbols === globals) {
3472134722 const primitives = mapDefined(
3472234723 ["string", "number", "boolean", "object", "bigint", "symbol"],
3472334724 s => symbols.has((s.charAt(0).toUpperCase() + s.slice(1)) as __String)
3472434725 ? createSymbol(SymbolFlags.TypeAlias, s as __String) as Symbol
3472534726 : undefined,
3472634727 );
34727- candidates = primitives.concat(arrayFrom(symbols.values()));
34728- }
34729- else {
34730- candidates = arrayFrom(symbols.values());
34728+ candidates = concatenate(candidates, primitives);
3473134729 }
3473234730 return getSpellingSuggestionForName(unescapeLeadingUnderscores(name), candidates, meaning);
3473334731 }
@@ -34738,7 +34736,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
3473834736 }
3473934737
3474034738 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
3474234740 }
3474334741
3474434742 function getSuggestionForNonexistentIndexSignature(objectType: Type, expr: ElementAccessExpression, keyedType: Type): string | undefined {
0 commit comments