This repository was archived by the owner on Nov 13, 2023. It is now read-only.
Description [@ genType ]
type t =
| A
| B ({name: string });
module X = {
[@ genType ]
let foo = (t: t ) => {
switch (t) {
| A => Js . log("A" )
| B ({name}) => Js . log("B" ++ name)
};
};
};
Gives
type $any = any ;
const $$toRE552311971 = { "A" : 0 } ;
// $FlowExpectedError: Reason checked type sufficiently
const CreateBucklescriptBlock = require ( 'bs_block' ) ;
// $FlowExpectedError: Reason checked type sufficiently
const GenTypeBugBS = require ( 'GenTypeBug.bs' ) ;
export type t = "A" | {| + name : string |};
const X_foo : ( t ) => void = function ( Arg1 : $any ) {
const result = GenTypeBugBS . X . foo ( typeof ( Arg1 ) === 'object'
? CreateBucklescriptBlock . __ ( 0 , Arg1 )
: $$toRE552311971 [ Arg1 ] ) ;
return result
} ; ;
exports . X_foo = X_foo
const X : { foo : ( t ) => void , ... } = GenTypeBugBS . X ;
exports . X = X
A call to Module.X.foo("A") won't use X_foo, it will use the BS.X.foo method directly
Reactions are currently unavailable
Gives
A call to
Module.X.foo("A")won't use X_foo, it will use the BS.X.foo method directly