Skip to content

Add Rails hook to automatically export typedefs when assets are compiled #8

@demsullivan

Description

@demsullivan

It would be great if type definitions could be exported automatically whenever assets are compiled in Rails.

dry-typesript could hook into the Rails asset compilation process and call Dry::Typescript.export before assets are compiled.

We would, however, need some way of specifying the output file path. Maybe use dry-configurable?

# config/initializers/dry-typescript.rb
Dry::Typescript.configure do |config|
  config.file_path = Rails.root.join("app", "javascript", "app", "dry-types.d.ts")
end

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