Skip to content

Remove typescript enums from generated code #111

@mcintyre94

Description

@mcintyre94

Currently we generate an enum for accounts and instructions.

I think we should instead generate these as eg:

export const TokenAccount = {
  Mint: "Mint",
  Token: "Token",
  Multisig: "Multisig",
} as const;

This would make them more legible when logged, and would give cleaner/more tree shakeable generated code.

To get the list of account names you'd need to use keyof typeof TokenAccount, but otherwise the use should be very similar to the current enum.

We would also need to update how we render DefinedTypeNode which is currently rendered as an enum. It might make sense to do similar to the above for that, or to do a union type.

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