# Representing IO in a spec

``````  @spec greeting(String.t) :: String.t
def greeting(name \\ nil, io \\ IO) do
# ...
end
``````

Per this article, I am inserting the IO module as an input to my function for testing purposes.

How do I represent this in my spec?

In `io.ex` in the Elixir source code. It appears that they use a type called `device`:

``````@type device :: atom | pid
``````
1 Like

The type of a module name is `atom()`.