}"
`;
+
+exports[`sfc reactive props destructure > with TSInstantiationExpression 1`] = `
+"import { defineComponent as _defineComponent } from 'vue'
+type Foo = <T extends string | number>(data: T) => void
+
+export default /*@__PURE__*/_defineComponent({
+ props: {
+ value: { type: Function }
+ },
+ setup(__props: any) {
+
+
+ const foo = __props.value<123>
+
+return () => {}
+}
+
+})"
+`;
}`)
})
+ test('with TSInstantiationExpression', () => {
+ const { content } = compile(
+ `
+ <script setup lang="ts">
+ type Foo = <T extends string | number>(data: T) => void
+ const { value } = defineProps<{ value: Foo }>()
+ const foo = value<123>
+ </script>
+ `,
+ { isProd: true },
+ )
+ assertCode(content)
+ expect(content).toMatch(`const foo = __props.value<123>`)
+ })
+
test('aliasing', () => {
const { content, bindings } = compile(`
<script setup>
import { walk } from 'estree-walker'
import {
BindingTypes,
+ TS_NODE_TYPES,
extractIdentifiers,
isFunctionType,
isInDestructureAssignment,
if (
parent &&
parent.type.startsWith('TS') &&
- parent.type !== 'TSAsExpression' &&
- parent.type !== 'TSNonNullExpression' &&
- parent.type !== 'TSSatisfiesExpression' &&
- parent.type !== 'TSTypeAssertion'
+ !TS_NODE_TYPES.includes(parent.type)
) {
return this.skip()
}