They haven't invaded Taiwan with the US providing an even less direct security guarantee.
The USA previously had a mutual defense treaty with Taiwan. That was replaced by the Taiwan Relations Act of 1979.
"The Taiwan Relations Act does not guarantee the USA will intervene militarily if the PRC attacks or invades Taiwan nor does it relinquish it, as its primary purpose is to ensure the US's Taiwan policy will not be changed unilaterally by the president and ensure any decision to defend Taiwan will be made with the consent of Congress. The act states that "the United States will make available to Taiwan such defense articles and defense services in such quantity as may be necessary to enable Taiwan to maintain a sufficient self-defense capabilities". However, the decision about the nature and quantity of defense services that America will provide to Taiwan is to be determined by the President and Congress. America's policy has been called "strategic ambiguity" and it is designed to dissuade Taiwan from a unilateral declaration of independence, and to dissuade the PRC from unilaterally unifying Taiwan with the PRC."[1]
If the US didn't have this agreement with Taiwan, I believe the PRC would have invaded long ago. Instead, they have been playing a long game of deeply entangling their economies and increasing their influence in the region with the hope of Taiwan following HK and joining the one country, two systems approach. I believe that is fundamentally dead now that the PRC has revealed one country, two systems to be a complete lie.
Thus, I hope Taiwan declares independence and has the backing the USA in such a manner that China won't consider invading.
Nonetheless, the point stands that China hasn't invaded Taiwan with a far less secure security guarantee than the one I proposed by the UK for HK.
No nuclear power has yet wanted to test whether or not a rival nuclear power is willing to follow through on their promise. Nuclear deterrence has been exceedingly effective. Furthermore, while China is more powerful than the UK, in 1997 the UK had a larger GDP and the EU was on the upswing.[2][3] That would have been sufficient counterweight to China then.
[1] https://en.wikipedia.org/wiki/Taiwan_Relations_Act#Military_...
[2] https://www.google.com/search?q=china+gdp+1997&oq=china+GDP+...
[3] https://www.google.com/search?q=UK+GDP+1997&oq=UK+GDP+1997&a...