generic type check