Some time we provide type to element ref and some time we don't, in both cases code works. what is the reason ?