snippet to check type restriction