Narrow types in if-else bodies if condition checks for type