Skip to content

Alba nested_attribute support #89

@pgiblock

Description

@pgiblock

Thanks for the awesome library! Combined with your alba-inertia, it is making my recent Vue/Inertia/Rails project a type-safe breeze.

I did just run into a problem though, and that's with Alba's nested attribute feature:

class Activities::Templates::IndexResource
  include Alba::Resource
  include Alba::Inertia::Resource
  include Typelizer::DSL

  typelize :boolean
  attribute test {|x| false}

  nested_attribute :nested do
    typelize :string
    attribute test1 {|x| "hello"}

    typelize :string
    attribute test2 {|x| "world"}
  end
end

This produces:

type ActivitiesTemplatesIndex = {
  test: boolean;
  nested: unknown;
}

Not sure exactly what I was expecting, but likely another type, similar to how typelizer handles traits.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions