type safe version of sizeOf