From 3807a43e39de4c5bae5225ab5a1db7772f6895a5 Mon Sep 17 00:00:00 2001 From: rkodev <43806892+rkodev@users.noreply.github.com> Date: Wed, 27 Sep 2023 17:59:43 +0300 Subject: [PATCH] Sort import order --- .../Writers/TypeScript/CodeFileDeclarationWriter.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Kiota.Builder/Writers/TypeScript/CodeFileDeclarationWriter.cs b/src/Kiota.Builder/Writers/TypeScript/CodeFileDeclarationWriter.cs index 4ed056a595..cbc09ffb01 100644 --- a/src/Kiota.Builder/Writers/TypeScript/CodeFileDeclarationWriter.cs +++ b/src/Kiota.Builder/Writers/TypeScript/CodeFileDeclarationWriter.cs @@ -34,12 +34,12 @@ public override void WriteCodeElement(CodeFileDeclaration codeElement, LanguageW // remove duplicate using, keep a single using for each internal type in the same namespace var enumeratedUsing = usings.ToArray(); - var filteredUsing = enumeratedUsing.Where(x => x.IsExternal) + var filteredUsing = enumeratedUsing.Where(static x => x.IsExternal) .Union(enumeratedUsing.ToArray() - .Where(x => x is { IsExternal: false, Declaration.TypeDefinition: not null }) - .GroupBy(x => + .Where(static x => x is { IsExternal: false, Declaration.TypeDefinition: not null }) + .GroupBy(static x => $"{x.Declaration!.TypeDefinition!.GetImmediateParentOfType().Name}.{x.Declaration?.Name.ToLowerInvariant()}") - .Select(x => x.First())); + .Select(static x => x.OrderBy(static x => x.Parent?.Name).First())); _codeUsingWriter.WriteCodeElement(filteredUsing, ns, writer); }