How to extract typespecs from a module?

I have a macro which creates few functions and typespecs for them as well two other module-wide types. What I’d like to have, is some tests that would verify those types are generated correctly. The most obvious way,Module.__info__/1, didn’t have the information I need.
Is there a way to extract all the typespecs a module has?

The t command in iex can do this, so look into the code in
where it defines IEX.Introspection.t

https://github.com/elixir-lang/elixir/blob/master/lib/iex/lib/iex/introspection.ex