# TypeVar Problem

**URL:** https://discourse.julialang.org/t/typevar-problem/22440
**Category:** General Usage
**Created:** [March 28, 2019, 3:37am UTC](https://discourse.julialang.org/t/typevar-problem/22440 "2019-03-28T03:37:06Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Qiyamah](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/qiyamah/32/2660_2.png) [@Qiyamah](https://discourse.julialang.org/u/Qiyamah)
#### Post date: [March 28, 2019, 3:37am UTC](https://discourse.julialang.org/t/typevar-problem/22440/1 "2019-03-28T03:37:06Z")

</div>

```nohighlight
abstract type MM{A} end
t = TypeVar(:T)

ff(::Type{T}) where T = T

MM{t} # this returns MM{T}, obviously a DataType
ff(Int) # this returns Int
ff(MM{t}) # ERROR: UndefVarError: T not defined

```

I see that I can’t construct a type using TypeVar.  
How can I get this done? Is there a way to expand a type consisting of a typevar to a full type?

Thanks

---

<div class="post-metadata">

### Author: ![Keno](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/keno/32/285_2.png) [@Keno](https://discourse.julialang.org/u/Keno)
#### Post date: [March 28, 2019, 11:51pm UTC](https://discourse.julialang.org/t/typevar-problem/22440/2 "2019-03-28T23:51:37Z")

</div>

`TypeVar` is an internal type. I’m not quite sure why it was ever exported. In your example `MM{t}` is an incomplete type because it contains a free typevar. A corresponding free type would be  
`MM{T} where T` for which:

```julia
julia> ff(MM{T} where T)
MM

```
