diff --git a/src/Kiota.Builder/Writers/TypeScript/CodeFileDeclarationWriter.cs b/src/Kiota.Builder/Writers/TypeScript/CodeFileDeclarationWriter.cs index cf712fc289..ae50a99fea 100644 --- a/src/Kiota.Builder/Writers/TypeScript/CodeFileDeclarationWriter.cs +++ b/src/Kiota.Builder/Writers/TypeScript/CodeFileDeclarationWriter.cs @@ -40,7 +40,7 @@ public override void WriteCodeElement(CodeFileDeclaration codeElement, LanguageW .Where(static x => x is { IsExternal: false, Declaration.TypeDefinition: not null }) .GroupBy(static x => $"{x.Declaration!.TypeDefinition!.GetImmediateParentOfType().Name}.{x.Declaration?.Name.ToLowerInvariant()}") - .Select(static x => x.OrderBy(static x => x.Parent?.Name).First())); + .Select(static x => x.OrderByDescending(static x => x.Alias).First())); _codeUsingWriter.WriteCodeElement(filteredUsing, ns, writer); }