typeof only accepts expressions, not types. Workaround: template myTypeOf(T...) if (T.length == 1) { static if (is(T)) alias myTypeOf = T; else alias myTypeOf = typeof(T); }