Inconsistent $ref codegen
Version
3.2.6
Reproduction link
Steps to reproduce
This repro tries to use a generically typed $ref<string | number>
:
https://sfc.vuejs.org/#eyJBcHAudnVlIjoiPHNjcmlwdCBzZXR1cCBsYW5nPVwidHNcIj5cbmltcG9ydCB7IHJlZiB9IGZyb20gJ3Z1ZSdcblxubGV0IG1zZyA9ICRyZWY8c3RyaW5nIHwgbnVtYmVyPignSGVsbG8gV29ybGQhJyk7XG5tc2cgPSA0Mjtcbjwvc2NyaXB0PlxuXG48dGVtcGxhdGU+XG4gIDxoMT57eyBtc2cgfX08L2gxPlxuICA8aW5wdXQgdi1tb2RlbD1cIm1zZ1wiPlxuPC90ZW1wbGF0ZT4ifQ==
It doesn't work and if you look at the JS code, $ref
was passed through without modification.
Strangely, if I add a second simple $ref
, such as in this example:
https://sfc.vuejs.org/#eyJBcHAudnVlIjoiPHNjcmlwdCBzZXR1cCBsYW5nPVwidHNcIj5cbmltcG9ydCB7IHJlZiB9IGZyb20gJ3Z1ZSdcblxubGV0IHggPSAkcmVmKDEpO1xubGV0IG1zZyA9ICRyZWY8c3RyaW5nIHwgbnVtYmVyPignSGVsbG8gV29ybGQhJyk7XG5tc2cgPSA0Mjtcbjwvc2NyaXB0PlxuXG48dGVtcGxhdGU+XG4gIDxoMT57eyBtc2cgfX08L2gxPlxuICA8aW5wdXQgdi1tb2RlbD1cIm1zZ1wiPlxuPC90ZW1wbGF0ZT4ifQ==
Now they're both correctly transformed??
What is expected?
First repro should work as well
What is actually happening?
$ref<string>
isn't transformed when there's no other $ref
.