Getting <<replace>> to work with <<type>>?

Sugarcube 2.35.0

I’m probably (definitely) missing something simple, but I can’t quite get this to work seemlessly.
This simple text dialogue replacing works as expected if you wait for each line of text to finish completing (ie wait for the type macro to finish).

However, if I click the “go on” button before a line is fully completed, the new line doesn’t appear at all… I feel like there’s something a bit odd about this. Shouldn’t the new line just overwrite the old line regardless of whether it has completed or not? And more to the point, is there a way I can achieve this behaviour? :stuck_out_tongue:

Here’s my code:

<<set _text to ["first thing I want to say", "second thing I want to say","third thing I want to say"]>>    
<<set _i to -1>>

<div id="NPCText"> </div>
        
  /*Button that adds more text to the NPCText div */
   <<button "go on...">>
            <<set _i++>>

            /* Display next bit */
              <<replace "#NPCText">>							
                <<type 20ms>> _text[_i] <</type>>						
             <</replace>>
<</button>>

Thanks so much!