# Irregularity in Context.typeof()

**URL:** <https://community.haxe.org/t/irregularity-in-context-typeof/2169>\
**Category:** Haxe\
**Created:** [December 3, 2019, 12:22am UTC](https://community.haxe.org/t/irregularity-in-context-typeof/2169 "2019-12-03T00:22:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![player\_03](https://community.haxe.org/user_avatar/community.haxe.org/player_03/32/821_2.png) [@player\_03](https://community.haxe.org/u/player_03)\
**Post date:** [December 3, 2019, 12:22am UTC](https://community.haxe.org/t/irregularity-in-context-typeof/2169/1 "2019-12-03T00:22:45Z")

</div>

Let’s say you have a function that prints a compile-time type:

```haxe
public static macro function printType(expr:Expr):Expr {
    trace(Context.typeof(expr));
    return macro null;
}

```

Plus a typedef:

```haxe
typedef Time = Date;

```

What happens when these things interact?

```haxe
printType(new Time(0, 0, 0, 0, 0, 0)); //Date

var time:Time = Date.now();
printType(time); //Time

var time = new Time(0, 0, 0, 0, 0, 0);
printType(time); //Date

printType((Date.now():Time)); //Time

```

I feel like all of these should actually print “Time.” Is there any way to make that happen?
