If manually specifying the interface for module, the @Gentype annotation does not work on functions, but works on types.
module Test: {
[@genType]
type t = pri string;
[@genType]
let make: t => string;
} = {
type t = string;
[@genType]
let make = t => t ++ "...";
};
Generates
export type Test_t = string;
But the Test_make function is not generated.
If I get rid of the type interface:
module Test = {
[@genType]
type t = string;
[@genType]
let make = t => t ++ "...";
};
Then both types are generated.
export const Test_make: (t:string) => string = MessageBS.Test.make;
export type Test_t = string;
The docs say that if .rei files exist it will take the annotations from there. However I've tried annotating in the interface and in the implementation and no combination could get it to output. The workaround I am using is to define another module and include it in the module that I manually type with an interface.
module Test_Types = {
/** I put shared types/functions here, but I can't use private types */
[@genType]
type t = string;
[@genType]
let make = t => t ++ "...";
};
module Test: {
include (module type of Test_Types);
} = {
include Test_Types;
};
Is this a bug or is there some other syntax for getting this to work?
If manually specifying the interface for module, the @Gentype annotation does not work on functions, but works on types.
Generates
But the Test_make function is not generated.
If I get rid of the type interface:
Then both types are generated.
The docs say that if .rei files exist it will take the annotations from there. However I've tried annotating in the interface and in the implementation and no combination could get it to output. The workaround I am using is to define another module and include it in the module that I manually type with an interface.
Is this a bug or is there some other syntax for getting this to work?