Skip to content

Replace poly variants that use @as with strings #748

@MoOx

Description

@MoOx

The problem

When using poly variants for string enums, we transformed a lot of "string-with-dash" to camel case stringWithoutDash, relying on ReScript @as annotation.
Now that ReScript allows poly variants to have string syntax, we could change this choice to make it more straight forward to new ReScript user that are familiar with React Native.

Considered solution

We could make this a breaking change. Maybe a codemod will help.

Alternatives solutions

We can also:

  • add strings values (so people can use both syntax (with-dash or withoutDash) and keep both (maintenance++)
  • integrate both & deprecate later withoutDash if that possible (syntax seems to be accepted but it doesn't seems to show the warning - I tested | @deprecated("use #\"plain-text\" instead of #plainText") @as("plain-text") #plainText in Alert.res)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions