Coda by Ian Macalinao
    Preparing search index...
    • Rewrites every non-erasable construct in a generated file so it compiles under erasableSyntaxOnly and runs under Node.js type stripping.

      Parameters

      • code: string

        The contents of a single generated file.

      Returns string

      The same file with only erasable TypeScript syntax.

      makeSyntaxErasable("export enum Key {\n  V1,\n  V2,\n}");
      // const KeyLookup = { 0: "V1", 1: "V2", V1: 0, V2: 1 } as const;
      //
      // export const Key: Omit<typeof KeyLookup, number> = KeyLookup;
      //
      // export type Key = (typeof Key)[keyof typeof Key];