✖
TypeHint[expr,type]
represents an expression of a specified type when compiled and gives expr when evaluated.
Examples
Basic Examples (1)Summary of the most common use cases
Define a function that uses TypeHint:
In[1]:=1

✖
https://wolfram.com/xid/0d6fvd0ieu-5gfvh
TypeHint evaluates to its first argument:
In[2]:=2

✖
https://wolfram.com/xid/0d6fvd0ieu-hama5d
Out[2]=2

TypeHint uses the type specification when compiled:
In[3]:=3

✖
https://wolfram.com/xid/0d6fvd0ieu-k4g3u9
Out[3]=3

In[4]:=4

✖
https://wolfram.com/xid/0d6fvd0ieu-r71lzn
Out[4]=4

Wolfram Research (2022), TypeHint, Wolfram Language function, https://reference.wolfram.com/language/ref/TypeHint.html.
✖
Wolfram Research (2022), TypeHint, Wolfram Language function, https://reference.wolfram.com/language/ref/TypeHint.html.
Text
Wolfram Research (2022), TypeHint, Wolfram Language function, https://reference.wolfram.com/language/ref/TypeHint.html.
✖
Wolfram Research (2022), TypeHint, Wolfram Language function, https://reference.wolfram.com/language/ref/TypeHint.html.
CMS
Wolfram Language. 2022. "TypeHint." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/TypeHint.html.
✖
Wolfram Language. 2022. "TypeHint." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/TypeHint.html.
APA
Wolfram Language. (2022). TypeHint. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/TypeHint.html
✖
Wolfram Language. (2022). TypeHint. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/TypeHint.html
BibTeX
✖
@misc{reference.wolfram_2025_typehint, author="Wolfram Research", title="{TypeHint}", year="2022", howpublished="\url{https://reference.wolfram.com/language/ref/TypeHint.html}", note=[Accessed: 23-April-2025
]}
BibLaTeX
✖
@online{reference.wolfram_2025_typehint, organization={Wolfram Research}, title={TypeHint}, year={2022}, url={https://reference.wolfram.com/language/ref/TypeHint.html}, note=[Accessed: 23-April-2025
]}