Alias a genType export?

Hey folks, I’ve got a module file named ElemNode.res in which I define a type t per the ReScript convention, and a bunch of functions which operate on this type t. I’m using genType to provide TypeScript support for my end users (I’m writing a library), which is great, but I’m wondering if I can write an alias in ReScript to define how these types will be named in the exported TypeScript. For example, right now my .gen.ts files all have a line like:

import type {t as ElemNode_t} from './ElemNode.gen';

and then throughout the rest of the .gen.ts file we have references to ElemNode_t. I’m wondering if it would be possible to choose a different name there that the TypeScript users would see. Even

import type {t as ElemNode} from './ElemNode.gen';

would be helpful.

I was hoping I’d be able to do something like this:

type t = Repr(t) | Number(float)

But that doesn’t appear to propagate to the .gen.ts files.

Is there a way to do this? Thanks


I also ran into this the other day and was unable to make it work.

I’m getting the same result as the test case in the compiler:

I.e. this:"ExportWithRename") @react.component
let make = (~s) => React.string(s)


export const make: React.ComponentType<{ readonly s: string }> = ExportWithRenameBS.ExportWithRename;

Not sure if that’s the expected behaviour or not.