Skip to content

Haskell types with a ' in the name result in broken code #34

@parsonsmatt

Description

@parsonsmatt

Suppose we have this:

data MyThing' a = MyThing a | Nope Int

$(deriveToJSONAndTypeScript defaultOptions ''MyThing')

It'll generate code like this:

export type TMyThing'<T> = IMyThing<T> | INope<T>

type IMyThing<T> = {
  tag: "MyThing"
  contents: T
}

type INope<T> = {
  tag: "Nope"
  contents: number
}

TypeScript fails to parse this.

It'd be nice if the TH code threw an error about it, instead.

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