gcanti / babel-plugin-tcomb

Babel plugin for static and runtime type checking using Flow and tcomb
MIT License
482 stars 22 forks source link

inspecting function argument and return types #172

Open benjamine opened 7 years ago

benjamine commented 7 years ago

I'm looking at the transpiled code and I noticed functions correctly get assertions for arguments and return types, but there doesn't seem to be a way to inspect these on runtime. is this a missing feature?

eg. tcomb allows defining function types with

// add takes two `t.Number`s and returns a `t.Number`
const add = t.func([t.Number, t.Number], t.Number)
  .of((x, y) => x + y);

this would allow us to use the meta object to inspect what are the expected arguments and return type of functions.