It seems I can maybe achieve this if I start with a fresh rescript project, configure GenType to output TSX files, and then define my build process as:
Compile rescript → TSX files
But before I get too far down this path, I figured I’d start here and see if anybody else is working in a similar structure.
I haven’t done anything like this, but as far as I know gentype already does everything you need - ReScript generates the JS, and gentype generates the TS at the same time.
Whether it’s used as part of a wider project or packaged for NPM shouldn’t make any difference. You can also ship all three variants and when used as a ReScript dependency the compiler will rebuild the JS if it needs to.
@Hongbo right ok, I understand. I suppose my API is not necessarily a small surface area but the complexity of the types are rather simple. I’ll see if I can set aside a day to evaluate ReScript’s gentype abilities for my specific use cases. If they’re sufficiently high quality, I’d much rather automatically generate than not.