Skip to content

Commit 973150a

Browse files
committed
Fix build
1 parent 811e073 commit 973150a

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

src/Kiota.Builder/Refiners/TypeScriptRefiner.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1462,7 +1462,7 @@ private static void AddDeserializerUsingToDiscriminatorFactoryForComposedTypePar
14621462

14631463
function.AddUsing(new CodeUsing
14641464
{
1465-
Name = modelDeserializerFunction.Parent.Name,
1465+
Name = modelDeserializerFunction.Name,
14661466
Declaration = new CodeType
14671467
{
14681468
Name = modelDeserializerFunction.Name,

src/Kiota.Builder/Writers/TypeScript/CodeFunctionWriter.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,10 @@ private string FindFunctionInNameSpace(string functionName, CodeElement codeElem
336336
var codeFunction = Array.Find(codeFunctions,
337337
func => func.GetImmediateParentOfType<CodeNamespace>().Name == myNamespace.Name) ??
338338
throw new InvalidOperationException($"Function {functionName} not found in namespace {myNamespace.Name}");
339-
return conventions.GetTypeString(new CodeType { TypeDefinition = codeFunction }, codeElement, false);
339+
340+
var targetElement = codeElement.GetImmediateParentOfType<CodeFile>();
341+
342+
return GetTypescriptTypeString(new CodeType { TypeDefinition = codeFunction }, targetElement, includeCollectionInformation: false);
340343
}
341344

342345
private void WriteSerializerFunction(CodeFunction codeElement, LanguageWriter writer)

src/Kiota.Builder/Writers/TypeScript/CodeMethodWriter.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ public override void WriteCodeElement(CodeMethod codeElement, LanguageWriter wri
1616
ArgumentNullException.ThrowIfNull(writer);
1717
if (codeElement.Parent is CodeFunction) return;
1818

19-
var returnType = GetTypescriptTypeString(codeElement.ReturnType, codeElement, inlineComposedTypeString: true);
19+
var codeFile = codeElement.GetImmediateParentOfType<CodeFile>();
20+
var returnType = GetTypescriptTypeString(codeElement.ReturnType, codeFile, inlineComposedTypeString: true);
2021
var isVoid = "void".EqualsIgnoreCase(returnType);
2122
WriteMethodDocumentation(codeElement, writer, isVoid);
2223
WriteMethodPrototype(codeElement, writer, returnType, isVoid);
@@ -30,6 +31,7 @@ private void WriteMethodDocumentation(CodeMethod code, LanguageWriter writer, bo
3031
}
3132
internal static void WriteMethodDocumentationInternal(CodeMethod code, LanguageWriter writer, bool isVoid, TypeScriptConventionService typeScriptConventionService)
3233
{
34+
var codeFile = code.GetImmediateParentOfType<CodeFile>();
3335
var returnRemark = (isVoid, code.IsAsync) switch
3436
{
3537
(true, _) => string.Empty,
@@ -41,7 +43,7 @@ internal static void WriteMethodDocumentationInternal(CodeMethod code, LanguageW
4143
code.Parameters
4244
.Where(static x => x.Documentation.DescriptionAvailable)
4345
.OrderBy(static x => x.Name)
44-
.Select(x => $"@param {x.Name} {x.Documentation.GetDescription(type => GetTypescriptTypeString(type, code, inlineComposedTypeString: true), ReferenceTypePrefix, ReferenceTypeSuffix, RemoveInvalidDescriptionCharacters)}")
46+
.Select(x => $"@param {x.Name} {x.Documentation.GetDescription(type => GetTypescriptTypeString(type, codeFile, inlineComposedTypeString: true), ReferenceTypePrefix, ReferenceTypeSuffix, RemoveInvalidDescriptionCharacters)}")
4547
.Union([returnRemark])
4648
.Union(GetThrownExceptionsRemarks(code)));
4749
}

0 commit comments

Comments
 (0)