Skip to content

Enums shouldn't export inline #11

@demsullivan

Description

@demsullivan

If you reference an enum from an array or a hash, the enum body gets exported inline which is invalid in Typescript.

Example:

module Types
  include Dry.Types()
  extend Dry::Typescript

  ts_export MyHash = Types::Hash.schema(enum: Types::String.enum('a', 'b'))
end

This will be exported as:

export type MyHash = {
  enum: A = "a"
  B = "b"
}

In use cases where the enum is defined inline as above, we will likely need to come up with an auto-generated name for it during export.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions