rescript-core icon indicating copy to clipboard operation
rescript-core copied to clipboard

Gentype bindings for Core Library

Open PritishBudhiraja opened this issue 1 year ago • 4 comments

Hey,

I was trying to add @genTypes in my project and I'm encountering this issue in my project.

So it's trying to look for the *.gen.tsx file for the core libraries types.

Attaching screenshot for the same. This should have by default created the ./JSON.gen or ./Promise.gen files.

How to overcome this issue? Is there a way or any Screenshot 2024-08-20 at 1 59 28 PM

PritishBudhiraja avatar Aug 20 '24 09:08 PritishBudhiraja

In rescript-schema, I solved it by publishing the package with .gen.ts files, containing the core types. There's no need to include types for functions.

DZakh avatar Aug 20 '24 09:08 DZakh

Sure @DZakh .

But this will solve temp fix. Can we get like a proper fix in RescriptCore library and it should create the own gen.tsx files and we should be able to use that. Is the under discussion or in roadmap?

PritishBudhiraja avatar Aug 20 '24 12:08 PritishBudhiraja

I think that genType got fixed with rescript-lang/rescript/pull/7285, can you confirm @cknitt @zth ?

tsnobip avatar Mar 07 '25 09:03 tsnobip

@tsnobip At least partially - there is a test for Promise.t here, but not for JSON.t: https://github.com/rescript-lang/rescript/blob/40c51a59c1cb04bdebfb4c302b1ede2a9101ebb0/tests/gentype_tests/typescript-react-example/src/Core.res#L29

cknitt avatar Mar 08 '25 16:03 cknitt