Skip to content

Commit

Permalink
misc: fixes
Browse files Browse the repository at this point in the history
various fixups
  • Loading branch information
andrewmd5 committed Oct 19, 2024
1 parent d686895 commit 1f349e8
Show file tree
Hide file tree
Showing 6 changed files with 896 additions and 229 deletions.
4 changes: 2 additions & 2 deletions .env
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION="3.1.2"
VERSION="3.1.3"
MAJOR=3
MINOR=1
PATCH=2
PATCH=3
2 changes: 2 additions & 0 deletions Core/Generators/TypeScript/TypeScriptGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -743,6 +743,8 @@ public override ValueTask<string> Compile(BebopSchema schema, GeneratorConfig co
{
// We codegen "1 as 1", "2 as 2"... because TypeScript otherwise infers the type "number" for this field, whereas a literal type is necessary to discriminate unions.
builder.AppendLine($"public readonly discriminator: number = {td.DiscriminatorInParent} as {td.DiscriminatorInParent};");
// back compaq for v2 usage where discriminator is a static field
builder.AppendLine($"public static readonly discriminator: number = {td.DiscriminatorInParent} as {td.DiscriminatorInParent};");
}
for (var i = 0; i < fd.Fields.Count; i++)
{
Expand Down
Loading

0 comments on commit 1f349e8

Please sign in to comment.