From 4c5ab1d9ab3cca36b430b847e0a83e8be4da9624 Mon Sep 17 00:00:00 2001 From: OKURA Masafumi Date: Wed, 6 Nov 2024 18:56:36 +0900 Subject: [PATCH] docs(README): Mention another usage of `typelize` I found this usage after reading the code, but it's better to mention it in README. --- README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/README.md b/README.md index d3a15c2..78d6eb3 100644 --- a/README.md +++ b/README.md @@ -82,6 +82,20 @@ class PostResource < ApplicationResource end ``` +`typelize` can be used with a Hash to specify multiple types at once. + +```ruby +class PostResource < ApplicationResource + attributes :id, :title, :body, :published_at + + attribute :author_name do |post| + post.author.name + end + + typelize author_name: :string, published_at: :string +end +``` + ### TypeScript Integration Typelizer generates TypeScript interfaces in the specified output directory: