Quantcast
Channel: ReScript Forum - Latest posts
Viewing all articles
Browse latest Browse all 2592

Module questions / "interface" functionality

$
0
0

Hello @elias-michaias and welcome to ReScript!

Thank you for your kind word about ReScript. :slight_smile:

For your first question, another way to solve it is to break down your main modules into packages inside a monorepo and use namespace in rescript.json.

{
  // ...
  "namespace": "MyLib1"
  // ... 
}

For your second question, another solution is to include the module type:

module type Foo = {
  type t = string
}

module Bar: {
  include Foo
  let baz: int => int
} = {
  type t = string
  // "extra" functionality
  let baz = x => x + 2
}

Bar.baz(4)->ignore
// no error anymore

Viewing all articles
Browse latest Browse all 2592

Trending Articles