From d8df4f368da1ddb079747227271618a30bab9230 Mon Sep 17 00:00:00 2001 From: Artur Drobinskiy Date: Thu, 2 Jun 2022 21:54:11 +0700 Subject: [PATCH] Fixes #1524: typescript checking fails on Dictionary (#1525) --- ...tionTests.Verify_output_style=Class_version=1.8.verified.txt | 2 +- ...tionTests.Verify_output_style=Class_version=2.1.verified.txt | 2 +- ...tionTests.Verify_output_style=Class_version=2.7.verified.txt | 2 +- ...tionTests.Verify_output_style=Class_version=4.3.verified.txt | 2 +- ...s.Verify_output_style=KnockoutClass_version=1.8.verified.txt | 2 +- ...s.Verify_output_style=KnockoutClass_version=2.1.verified.txt | 2 +- ...s.Verify_output_style=KnockoutClass_version=2.7.verified.txt | 2 +- ...s.Verify_output_style=KnockoutClass_version=4.3.verified.txt | 2 +- .../Templates/ConvertToJavaScript.liquid | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/NJsonSchema.CodeGeneration.TypeScript.Tests/Snapshots/ClassGenerationTests.Verify_output_style=Class_version=1.8.verified.txt b/src/NJsonSchema.CodeGeneration.TypeScript.Tests/Snapshots/ClassGenerationTests.Verify_output_style=Class_version=1.8.verified.txt index 1658597f0..3f470a61a 100644 --- a/src/NJsonSchema.CodeGeneration.TypeScript.Tests/Snapshots/ClassGenerationTests.Verify_output_style=Class_version=1.8.verified.txt +++ b/src/NJsonSchema.CodeGeneration.TypeScript.Tests/Snapshots/ClassGenerationTests.Verify_output_style=Class_version=1.8.verified.txt @@ -169,7 +169,7 @@ export class MyClass implements IMyClass { data["PrimitiveDictionary"] = {}; for (let key in this.primitiveDictionary) { if (this.primitiveDictionary.hasOwnProperty(key)) - (data["PrimitiveDictionary"])[key] = this.primitiveDictionary[key]; + (data["PrimitiveDictionary"])[key] = (this.primitiveDictionary)[key]; } } if (Array.isArray(this.dateArray)) { diff --git a/src/NJsonSchema.CodeGeneration.TypeScript.Tests/Snapshots/ClassGenerationTests.Verify_output_style=Class_version=2.1.verified.txt b/src/NJsonSchema.CodeGeneration.TypeScript.Tests/Snapshots/ClassGenerationTests.Verify_output_style=Class_version=2.1.verified.txt index 6054a4dcc..47f8a76ad 100644 --- a/src/NJsonSchema.CodeGeneration.TypeScript.Tests/Snapshots/ClassGenerationTests.Verify_output_style=Class_version=2.1.verified.txt +++ b/src/NJsonSchema.CodeGeneration.TypeScript.Tests/Snapshots/ClassGenerationTests.Verify_output_style=Class_version=2.1.verified.txt @@ -169,7 +169,7 @@ export class MyClass implements IMyClass { data["PrimitiveDictionary"] = {}; for (let key in this.primitiveDictionary) { if (this.primitiveDictionary.hasOwnProperty(key)) - (data["PrimitiveDictionary"])[key] = this.primitiveDictionary[key]; + (data["PrimitiveDictionary"])[key] = (this.primitiveDictionary)[key]; } } if (Array.isArray(this.dateArray)) { diff --git a/src/NJsonSchema.CodeGeneration.TypeScript.Tests/Snapshots/ClassGenerationTests.Verify_output_style=Class_version=2.7.verified.txt b/src/NJsonSchema.CodeGeneration.TypeScript.Tests/Snapshots/ClassGenerationTests.Verify_output_style=Class_version=2.7.verified.txt index 909b7ed17..7261c16a6 100644 --- a/src/NJsonSchema.CodeGeneration.TypeScript.Tests/Snapshots/ClassGenerationTests.Verify_output_style=Class_version=2.7.verified.txt +++ b/src/NJsonSchema.CodeGeneration.TypeScript.Tests/Snapshots/ClassGenerationTests.Verify_output_style=Class_version=2.7.verified.txt @@ -169,7 +169,7 @@ export class MyClass implements IMyClass { data["PrimitiveDictionary"] = {}; for (let key in this.primitiveDictionary) { if (this.primitiveDictionary.hasOwnProperty(key)) - (data["PrimitiveDictionary"])[key] = this.primitiveDictionary[key]; + (data["PrimitiveDictionary"])[key] = (this.primitiveDictionary)[key]; } } if (Array.isArray(this.dateArray)) { diff --git a/src/NJsonSchema.CodeGeneration.TypeScript.Tests/Snapshots/ClassGenerationTests.Verify_output_style=Class_version=4.3.verified.txt b/src/NJsonSchema.CodeGeneration.TypeScript.Tests/Snapshots/ClassGenerationTests.Verify_output_style=Class_version=4.3.verified.txt index 1958a8639..d3cf435ab 100644 --- a/src/NJsonSchema.CodeGeneration.TypeScript.Tests/Snapshots/ClassGenerationTests.Verify_output_style=Class_version=4.3.verified.txt +++ b/src/NJsonSchema.CodeGeneration.TypeScript.Tests/Snapshots/ClassGenerationTests.Verify_output_style=Class_version=4.3.verified.txt @@ -169,7 +169,7 @@ export class MyClass implements IMyClass { data["PrimitiveDictionary"] = {}; for (let key in this.primitiveDictionary) { if (this.primitiveDictionary.hasOwnProperty(key)) - (data["PrimitiveDictionary"])[key] = this.primitiveDictionary[key]; + (data["PrimitiveDictionary"])[key] = (this.primitiveDictionary)[key]; } } if (Array.isArray(this.dateArray)) { diff --git a/src/NJsonSchema.CodeGeneration.TypeScript.Tests/Snapshots/ClassGenerationTests.Verify_output_style=KnockoutClass_version=1.8.verified.txt b/src/NJsonSchema.CodeGeneration.TypeScript.Tests/Snapshots/ClassGenerationTests.Verify_output_style=KnockoutClass_version=1.8.verified.txt index 2a088c19a..40c378a7d 100644 --- a/src/NJsonSchema.CodeGeneration.TypeScript.Tests/Snapshots/ClassGenerationTests.Verify_output_style=KnockoutClass_version=1.8.verified.txt +++ b/src/NJsonSchema.CodeGeneration.TypeScript.Tests/Snapshots/ClassGenerationTests.Verify_output_style=KnockoutClass_version=1.8.verified.txt @@ -187,7 +187,7 @@ export class MyClass { data["PrimitiveDictionary"] = {}; for (let key in primitiveDictionary_) { if (primitiveDictionary_.hasOwnProperty(key)) - (data["PrimitiveDictionary"])[key] = primitiveDictionary_[key]; + (data["PrimitiveDictionary"])[key] = (primitiveDictionary_)[key]; } } diff --git a/src/NJsonSchema.CodeGeneration.TypeScript.Tests/Snapshots/ClassGenerationTests.Verify_output_style=KnockoutClass_version=2.1.verified.txt b/src/NJsonSchema.CodeGeneration.TypeScript.Tests/Snapshots/ClassGenerationTests.Verify_output_style=KnockoutClass_version=2.1.verified.txt index 80d6b9d3f..f5426fd89 100644 --- a/src/NJsonSchema.CodeGeneration.TypeScript.Tests/Snapshots/ClassGenerationTests.Verify_output_style=KnockoutClass_version=2.1.verified.txt +++ b/src/NJsonSchema.CodeGeneration.TypeScript.Tests/Snapshots/ClassGenerationTests.Verify_output_style=KnockoutClass_version=2.1.verified.txt @@ -187,7 +187,7 @@ export class MyClass { data["PrimitiveDictionary"] = {}; for (let key in primitiveDictionary_) { if (primitiveDictionary_.hasOwnProperty(key)) - (data["PrimitiveDictionary"])[key] = primitiveDictionary_[key]; + (data["PrimitiveDictionary"])[key] = (primitiveDictionary_)[key]; } } diff --git a/src/NJsonSchema.CodeGeneration.TypeScript.Tests/Snapshots/ClassGenerationTests.Verify_output_style=KnockoutClass_version=2.7.verified.txt b/src/NJsonSchema.CodeGeneration.TypeScript.Tests/Snapshots/ClassGenerationTests.Verify_output_style=KnockoutClass_version=2.7.verified.txt index 6f9d1b329..597c5cc2f 100644 --- a/src/NJsonSchema.CodeGeneration.TypeScript.Tests/Snapshots/ClassGenerationTests.Verify_output_style=KnockoutClass_version=2.7.verified.txt +++ b/src/NJsonSchema.CodeGeneration.TypeScript.Tests/Snapshots/ClassGenerationTests.Verify_output_style=KnockoutClass_version=2.7.verified.txt @@ -187,7 +187,7 @@ export class MyClass { data["PrimitiveDictionary"] = {}; for (let key in primitiveDictionary_) { if (primitiveDictionary_.hasOwnProperty(key)) - (data["PrimitiveDictionary"])[key] = primitiveDictionary_[key]; + (data["PrimitiveDictionary"])[key] = (primitiveDictionary_)[key]; } } diff --git a/src/NJsonSchema.CodeGeneration.TypeScript.Tests/Snapshots/ClassGenerationTests.Verify_output_style=KnockoutClass_version=4.3.verified.txt b/src/NJsonSchema.CodeGeneration.TypeScript.Tests/Snapshots/ClassGenerationTests.Verify_output_style=KnockoutClass_version=4.3.verified.txt index 246e32f15..1a67d9e52 100644 --- a/src/NJsonSchema.CodeGeneration.TypeScript.Tests/Snapshots/ClassGenerationTests.Verify_output_style=KnockoutClass_version=4.3.verified.txt +++ b/src/NJsonSchema.CodeGeneration.TypeScript.Tests/Snapshots/ClassGenerationTests.Verify_output_style=KnockoutClass_version=4.3.verified.txt @@ -187,7 +187,7 @@ export class MyClass { data["PrimitiveDictionary"] = {}; for (let key in primitiveDictionary_) { if (primitiveDictionary_.hasOwnProperty(key)) - (data["PrimitiveDictionary"])[key] = primitiveDictionary_[key]; + (data["PrimitiveDictionary"])[key] = (primitiveDictionary_)[key]; } } diff --git a/src/NJsonSchema.CodeGeneration.TypeScript/Templates/ConvertToJavaScript.liquid b/src/NJsonSchema.CodeGeneration.TypeScript/Templates/ConvertToJavaScript.liquid index 93102c78c..7660ce78d 100644 --- a/src/NJsonSchema.CodeGeneration.TypeScript/Templates/ConvertToJavaScript.liquid +++ b/src/NJsonSchema.CodeGeneration.TypeScript/Templates/ConvertToJavaScript.liquid @@ -29,7 +29,7 @@ if ({{ Value }}) { {%- if NullValue != "undefined" -%} ({{ Variable }})[key] = {{ Value }}[key] !== undefined ? {{ Value }}[key] : {{ NullValue }}; {%- else -%} - ({{ Variable }})[key] = {{ Value }}[key]; + ({{ Variable }})[key] = ({{ Value }})[key]; {%- endif -%} {%- endif -%} }