Processes can only pass strings as arguments, so what you will get will always be a string. It's up to you to interpret the value as what you need (e. g. an integer).
In your case I think checking if the given string consists solely of digits would solve your issue. There are many ways to do this check, but here is my favorite:
if ( "$1" == "-d" ) then
expr "$2" : '[0-9]*$' > /dev/null && echo "We have a number" || echo "We have a non-number"
endif