Skip to content

Releases: skryukov/typelizer

v0.4.1

10 Jun 20:28
84ed80c
Compare
Choose a tag to compare

What's Changed

Added

  • Add option to use double quotes in generated TypeScript interfaces through prefer_double_quotes config option (@kristinemcbride)

Fixed

  • Fix types not being generated on the fly since [0.2.0]. (@skryukov)
  • Improve memory consumption (~100x less memory) & speed of types generation (~5x faster). (@skryukov)
  • Fix nullable detection for belongs_to associations with :active_record strategy. (@NOX73)
  • Alba: fix unknown type for conditional attribute with transform_keys. (@nkriege)

New Contributors

Full Changelog: v0.4.0...v0.4.1

v0.4.0

03 May 17:34
ca67584
Compare
Choose a tag to compare

Added

  • Support for panko_serializer gem (@PedroAugustoRamalhoDuarte, @skryukov)

  • Mark has_one and belongs_to association as nullable. (@skryukov)

    By default, has_one associations are marked as nullable in TypeScript interfaces.
    belongs_to associations are marked as nullable if the database column is nullable.
    Use the new config.associations_strategy = :active_record configuration option to mark associations as nullable based on the required/optional options.
    You can also use the type hint typelize latest_post: {nullable: false} in the serializer to override the defaults.

  • Support inherited typelization. (@skryukov)

    Set config.inheritance_strategy = :inheritance to make Typelizer respect the inheritance hierarchy of serializers:

      class AdminSerializer < UserSerializer
        attributes :admin_level
      end
      // app/javascript/types/serializers/Admin.ts
      import { User } from "@/types";
      
      export type Admin = User & {
        admin_level: number;
      }

Fixed

  • Alba: always use strings for keys in properties. (@skryukov)
    This change will fire update of all hashes for Alba serializers, but it's necessary to support inheritance strategy.

New Contributors

Full Changelog: v0.3.0...v0.4.0

v0.3.0

01 Mar 08:16
b06d3fd
Compare
Choose a tag to compare

Added

  • Support transform keys. (@patvice, @skryukov)

    Typelizer now respects transform_keys/key_transform configurations for all plugins.

  • Support typing method def in Alba. (@patvice)

    The typelize helper now can be used before a method definition:

    class UserResource < ApplicationResource
      attributes :id, :name, :email, :chars_in_name
    
      typelize :number
      def chars_in_name(obj)
        obj.name.chars.count
      end
    end
  • Support for deprecated attributes. (@Envek)

    They will be marked as deprecated using JSDoc @deprecated tag in TypeScript interface comments.

    In ActiveModel::Serializer attributes deprecated option is recognized.

    For other serializers, you can use deprecated option of typelize method.

Fixed

  • Ignore nil values on fingerprint calculation. (@Envek)

Full Changelog: v0.2.0...v0.3.0

v0.2.0

26 Nov 12:03
c8fcf9a
Compare
Choose a tag to compare

Added

  • Add support for enum attributes declared using ActiveRecord::Enum or explicitly in serializers (@Envek)
  • Add support for comments in generated TypeScript interfaces (@Envek)
  • Add TypeScript verbatim module syntax support through verbatim_module_syntax config option (@patvice)
  • Add typelizer:generate:refresh command to clean output directory and regenerate all interfaces (@patvice)
  • Allow disabling Typelizer in Rails development with DISABLE_TYPELIZER environment variable to true (@okuramasafumi)
  • Allow to get interfaces without generating TypeScript files (@Envek)

Fixes

  • Do not override Typelizer.dirs in the railtie initializer (@patvice)
  • Do not raise on empty nested serializers (@skryukov)
  • Attribute options merging in inherited serializers (@Envek)
  • Allow recursive type definition (@okuramasafumi)

New Contributors

  • @Envek made their first contribution in #21

Full Changelog: v0.1.5...v0.2.0

v0.1.5

07 Oct 15:18
9339681
Compare
Choose a tag to compare

Fixed

  • Fix the duplicated import with multiple same association (@okuramasafumi)

Full Changelog: v0.1.4...v0.1.5

v0.1.4

04 Oct 12:40
82a6c62
Compare
Choose a tag to compare

Added

Full Changelog: v0.1.3...v0.1.4

v0.1.3

27 Sep 11:58
0b0015a
Compare
Choose a tag to compare

Added

  • Support inline associations (@okuramasafumi, @skryukov)

    Example of Alba serializer with inline associations (note the helper Typelizer::DSL, see Alba's docs for more details):

    class FooSerializer
      include Alba::Resource
      helper Typelizer::DSL
    
      many :bars do
        typelize_from Bar
    
        attributes :id, :name
      end
    end

Full Changelog: v0.1.2...v0.1.3

v0.1.2

05 Sep 08:24
5284071
Compare
Choose a tag to compare

Fixed

New Contributors

Full Changelog: v0.1.1...v0.1.2

v0.1.1

26 Aug 18:53
ab90684
Compare
Choose a tag to compare

Fixed

New Contributors

Full Changelog: v0.1.0...v0.1.1

v0.1.0

26 Aug 18:52
5cf1cdd
Compare
Choose a tag to compare

Added

Full Changelog: https://github.com/skryukov/typelizer/commits/v0.1.0