Skip to content

Commit

Permalink
testing map vs record. map preferable
Browse files Browse the repository at this point in the history
  • Loading branch information
CodySchrank committed Feb 16, 2020
1 parent 852f6d2 commit 8c95623
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Example/Example.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<ItemGroup>
<!-- <PackageReference Include="MTT" Version="0.6.4-*" PrivateAssets="All" /> -->
<PackageReference Include="MTT" Version="0.6.4" />
<PackageReference Include="MTT" Version="0.6.5" />
</ItemGroup>

<Target Name="ConvertMain" BeforeTargets="PrepareForBuild">
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export interface Vehicle extends Entity {
make: string;
model: string;
mileage?: number;
options: Record<string, Units>;
options: Map<string, Units>;
condition: VehicleState;
parts: Part[];
spareParts: Part[];
Expand Down Expand Up @@ -132,6 +132,8 @@ It correctly converts the following C# types to the equivalent typescript:
* Optional
* virtual
* abstract
* Dictionary
* IDictionary

## Notes

Expand Down
2 changes: 1 addition & 1 deletion Source/MTT/ConvertService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ private void BreakDown()
LineObject obj = new LineObject()
{
VariableName = varName,
Type = "Record",
Type = "Map",
IsArray = false,
IsOptional = isOptional,
UserDefined = false,
Expand Down
2 changes: 1 addition & 1 deletion Source/MTT/MTT.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<!-- Change the default location where NuGet will put the build output -->
<BuildOutputTargetFolder>tasks</BuildOutputTargetFolder>
<!-- set the version automatically -->
<VersionPrefix>0.6.4</VersionPrefix>
<VersionPrefix>0.6.5</VersionPrefix>
<!--
The suffix is required because nuget will only update if the package is newer, this tricks it.
note: 0.1.5 has precedence over 0.1.5-build123412341
Expand Down
4 changes: 2 additions & 2 deletions Source/MTTRunner.Tests/UnitTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,10 @@ public void OptionalPropertyExists() {
}

[Test]
public void CheckRecordExists() {
public void CheckMapExists() {
string[] lines = System.IO.File.ReadAllLines(VehicleFile);

Assert.That(lines[12], Is.EqualTo(" options: Record<string, Units>;"));
Assert.That(lines[12], Is.EqualTo(" options: Map<string, Units>;"));
}

[Test]
Expand Down

0 comments on commit 8c95623

Please sign in to comment.