of course, if you use your types exactly the same way both inside and outside, this looks like useless duplication, but there are many cases where the types are not the same, you could have for example a record in your implementation and an opaque or private type in your interface.
As @zth said, there are things we could improve around editor tooling for this.
Meanwhile, there’s a strategy that can work well for the files where you have a lot of identical types in your implementation and interface files, let’s say you have a file A.res, you can create an ATypes.res where you’d define those types and you’d include it both in A.res and A.resi:
module ATypes = {
type foo = {
bar: int,
baz: string,
// ...
}
type bazz = {
foo: foo,
barr: int,
// ...
}
// ...
}
module A: {
include module type of ATypes
let foo: (int, string) => foo
} = {
include ATypes
let foo = (bar, baz) => {bar, baz}
}