fix(compiler-sfc): fix template usage check false positives on types

fix #5414
This commit is contained in:
Evan You
2022-05-12 18:23:10 +08:00
parent ba17792b72
commit ccf92564d3
3 changed files with 71 additions and 8 deletions

View File

@@ -432,6 +432,23 @@ defineExpose({ foo: 123 })
expect(content).toMatch(`return { FooBaz, Last }`)
assertCode(content)
})
test('TS annotations', () => {
const { content } = compile(`
<script setup lang="ts">
import { Foo, Bar, Baz } from './x'
const a = 1
function b() {}
</script>
<template>
{{ a as Foo }}
{{ b<Bar>() }}
{{ Baz }}
</template>
`)
expect(content).toMatch(`return { a, b, Baz }`)
assertCode(content)
})
})
describe('inlineTemplate mode', () => {