# How to declare type variables using elixir/dialyixir?

**URL:** <https://forum.elixirforum.com/t/how-to-declare-type-variables-using-elixir-dialyixir/13948>\
**Category:** Questions\
**Tags:** dialyzer, algebraic\_data\_type, typespecs, dialyxir\
**Created:** [April 29, 2018, 4:36pm UTC](https://forum.elixirforum.com/t/how-to-declare-type-variables-using-elixir-dialyixir/13948 "2018-04-29T16:36:09Z")\
**Posts on this page:** 1\
**Showing post:** 12

<div class="post-metadata">

**Author:** ![OvermindDL1](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/overminddl1/32/2677_2.png) [@OvermindDL1](https://forum.elixirforum.com/u/OvermindDL1)\
**Post date:** [May 2, 2018, 7:33pm UTC](https://forum.elixirforum.com/t/how-to-declare-type-variables-using-elixir-dialyixir/13948/12 "2018-05-02T19:33:10Z")

</div>

> [@Crowdhailer](#):
>
> Does anyone do this or similar.
> 
> Here I am using a spec’d identity function to “cast” a binary to an opaque type which will instruct dialyzer to warn when I try to use it in normal strip operation.

Yep. I _LOVE_ this pattern and use it excessively at times in a large variety of languages. ^.^

---

_[View the full topic](https://forum.elixirforum.com/t/how-to-declare-type-variables-using-elixir-dialyixir/13948)._
