Module type in .resi file

Hi everyone!
I am new to Rescript and I am a bit stuck with a .resi file. I wanted to create a GeneralType.resi file to enforce the same type on multiple modules with:

module type GeneralType = {
    let has_parameters: bool
    let parameters: int
}

and I thought I could use this module type with multiple modules with different names. However, I get the following error: GeneralType does not have implementation file. I don’t want to create a GeneralType.res file, I want to use this type in multiple modules.
How can I put a module type into a .resi file to use it in different modules with different names?
Thank you!

1 Like

ReScript doesn’t support that. But you can put the module type in a .res file, e.g. GeneralType.res:

module type S = {
  let has_parameters: bool
  let parameters: int
}

It’s customary to call the main module type S (‘signature’).

Now you can use GeneralType.S as a module type.

2 Likes

I understand now, thank you very much!

1 Like