Due to the weak screening effect, the concentration and type of charge carriers in 2D semiconductor heterostructures can be effectively tuned by electrostatic gating, enabling us to realize different types of heterojunctions in a single device. Such 'type tunable' properties are useful for designing novel electrical or optoelectrical devices. Here, we demonstrate a 'type tunable' heterojunction device construct with two pieces of ambipolar 2D semiconductors: WSe2 and black phosphorus (BP). This heterojunction could be tuned to either the p-p junction or n-n junction by gate modulation. The p-p junction shows a large current rectification ratio while the n-n junction shows a negligible current rectification ratio, indicating a large valence band offset and a small conduction band offset at the WSe2/BP interface. In the optoelectrical measurements, we found the amplitude and even the polarity of photocurrent could be modulated by electrostatic gating. Our study could further enhance the understanding of designing devices based on these 'type tunable' van der Waals heterojunctions. Moreover, the properties of the WSe2/BP interface were also experimentally identified through the electrical and optoelectrical measurements in our study.