Skip to content

v0.82.0

Latest

Choose a tag to compare

@joshmossas joshmossas released this 21 May 18:59
· 1 commit to master since this release

I marked this as a breaking change just in case, however nobody should be broken by these changes.

What's Changed

Typescript

Enum Generation

For enums ts-codegen will now also output a static object with all of the possible values. Example:

// before
export type MyEnum = (typeof $$MyEnumValues)[number];
const $$MyEnumValues = ["foo", "bar", "baz"];

// after
export type MyEnum = "foo" | "bar" | "baz";
export const MyEnum = {
  Foo: "foo",
  Bar: "bar",
  Baz: "baz",
} as const;
const $$MyEnumValues = ["foo", "bar", "baz"];

This allows users to access enum variants like so if they so choose:

console.log(MyEnum.Foo)

The actual type remains a string union so consumers aren't affected.

Lines of Code Reduction

The generated typescript code now outputs 10%-25% less lines of code on average.

PRs:

  • feature: make ts clients coerce bigints
  • feature: ts enum generation improvements by @joshmossas in #195
  • feature: reduce line-count of generated ts code by @joshmossas in #196

Full Changelog: v0.81.3...v0.82.0