diff --git a/packages/babel-plugin-resolve-type/test/__snapshots__/resolve-type.test.tsx.snap b/packages/babel-plugin-resolve-type/test/__snapshots__/resolve-type.test.tsx.snap index baa55e9..ccf0e45 100644 --- a/packages/babel-plugin-resolve-type/test/__snapshots__/resolve-type.test.tsx.snap +++ b/packages/babel-plugin-resolve-type/test/__snapshots__/resolve-type.test.tsx.snap @@ -80,3 +80,10 @@ defineComponent((props: { } });" `; + +exports[`resolve type > w/ tsx 1`] = ` +"import { type SetupContext, defineComponent } from 'vue'; +const Comp = defineComponent(() => { + return () =>
; +}, {});" +`; diff --git a/packages/babel-plugin-resolve-type/test/resolve-type.test.tsx b/packages/babel-plugin-resolve-type/test/resolve-type.test.tsx index db22e8b..5830de4 100644 --- a/packages/babel-plugin-resolve-type/test/resolve-type.test.tsx +++ b/packages/babel-plugin-resolve-type/test/resolve-type.test.tsx @@ -2,7 +2,9 @@ import { transformAsync } from '@babel/core'; import ResolveType from '../src'; async function transform(code: string): Promise { - const result = await transformAsync(code, { plugins: [ResolveType] }); + const result = await transformAsync(code, { + plugins: [[ResolveType, { isTSX: true }]], + }); return result!.code!; } @@ -72,4 +74,16 @@ describe('resolve type', () => { expect(result).toMatchSnapshot(); }); }); + + test('w/ tsx', async () => { + const result = await transform( + ` + import { type SetupContext, defineComponent } from 'vue'; + const Comp = defineComponent(() => { + return () =>
; + }); + ` + ); + expect(result).toMatchSnapshot(); + }); });