Is there a way to print all the types of all functions in a module (without creating the resi file)

We’re migrating a code base to use the async/await, and we have found some developers accidentally create functions returning promise<promise<...>> because they forget to use await at some point.

I would like to have a check in our pipeline that finds those promise<promise<'a>> and generate a warning in the PR.

Is there a way to get the type info from a module using a cli tool?

No official tool yet, the CLI tool you want is currently in development.

For now you could use the rescript-editor-analysis.exe from rescript-vscode’s GitHub actions. E.g. download and unzip the ubuntu-20.04 artifact and put it in your repo.

Usage (needs both path to .res and compiled interface file .cmi):

./rescript-editor-analysis.exe createInterface src/MyFile.res lib/bs/src/MyFile.cmi

Disclaimer: It is an internal tool, API is subject to change!.

2 Likes