fix(ref-transform): should transform $ref when used with generic arguments (#4446)
fix #4442
This commit is contained in:
@@ -99,6 +99,19 @@ describe('sfc ref transform', () => {
|
||||
assertCode(content)
|
||||
})
|
||||
|
||||
test('usage /w typescript', () => {
|
||||
const { content } = compileWithRefTransform(`
|
||||
<script setup lang="ts">
|
||||
let msg = $ref<string | number>('foo');
|
||||
let bar = $ref <string | number>('bar');
|
||||
</script>
|
||||
`)
|
||||
expect(content).toMatch(`import { ref as _ref`)
|
||||
expect(content).toMatch(`let msg = _ref<string | number>('foo')`)
|
||||
expect(content).toMatch(`let bar = _ref <string | number>('bar')`)
|
||||
assertCode(content)
|
||||
})
|
||||
|
||||
test('usage with normal <script> + <script setup>', () => {
|
||||
const { content, bindings } = compileWithRefTransform(`<script>
|
||||
let a = $ref(0)
|
||||
|
||||
Reference in New Issue
Block a user