Skip to content

Commit

Permalink
- adds error prototype inheritance for typescript
Browse files Browse the repository at this point in the history
Signed-off-by: Vincent Biret <vibiret@microsoft.com>
  • Loading branch information
baywet committed Feb 10, 2022
1 parent 5a74e8c commit 9713b9c
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Kiota.Builder/Writers/TypeScript/CodeMethodWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ private static void WriteSerializationRegistration(List<string> serializationMod
private void WriteConstructorBody(CodeClass parentClass, CodeMethod currentMethod, LanguageWriter writer, bool inherits) {
if(inherits || parentClass.IsErrorDefinition)
writer.WriteLine("super();");
if(parentClass.IsErrorDefinition && parentClass.StartBlock is CodeClass.Declaration declaration)
writer.WriteLine($"Object.setPrototypeOf(this, {declaration.Inherits.Name.ToFirstCharacterUpperCase()}.prototype);");
var propertiesWithDefaultValues = new List<CodePropertyKind> {
CodePropertyKind.AdditionalData,
CodePropertyKind.BackingStore,
Expand Down

0 comments on commit 9713b9c

Please sign in to comment.