Skip to content

Commit

Permalink
docs(README): Mention another usage of typelize
Browse files Browse the repository at this point in the history
I found this usage after reading the code, but it's better to
mention it in README.
  • Loading branch information
okuramasafumi authored and skryukov committed Nov 6, 2024
1 parent c1a24e9 commit 4c5ab1d
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 4c5ab1d

Please sign in to comment.