# Typelizer

> A TypeScript type generator for Ruby serializers.

- URL: https://evilmartians.com/opensource/typelizer
- GitHub: https://github.com/skryukov/typelizer
- Authors: Svyatoslav Kryukov

---

Typelizer is a Ruby gem that automatically generates TypeScript interfaces from your Ruby serializers, bridging the gap between your Ruby backend and TypeScript frontend. It supports multiple serializer libraries and provides a flexible configuration system, making it easier to maintain type consistency across your full-stack application.

## Features

- Automatic TypeScript interface generation
- Support for multiple serializer libraries (`Alba`, `ActiveModel::Serializer`, `Oj::Serializer`)
- File watching and automatic regeneration in development

## Installation

To install Typelizer, add the following line to your `Gemfile` and run `bundle install`:

```ruby
gem "typelizer"
```

## Usage

### Basic Setup

Include the Typelizer DSL in your serializers:

```ruby
class ApplicationResource
  include Alba::Resource
  include Typelizer::DSL
end

class PostResource < ApplicationResource
  attributes :id, :title, :body

  has_one :author, serializer: AuthorResource
end

class AuthorResource < ApplicationResource
  # specify the model to infer types from (optional)
  typelize_from User

  attributes :id, :name
end
```

Typelizer will automatically generate TypeScript interfaces based on your serializer definitions using information from your models.
