Skip to content

Commit df8d0a5

Browse files
committed
test: add tests for vuejs/core#8468
1 parent 610941d commit df8d0a5

File tree

4 files changed

+44
-0
lines changed

4 files changed

+44
-0
lines changed

test/__fixtures__/core#8468-props.ts

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
type Text = { type: "text"; value: string };
2+
type Number = { type: "number"; value: number };
3+
4+
export type Inputs = Text | Number;

test/__fixtures__/core#8468.vue

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<script setup lang="ts" generic="P extends Inputs">
2+
import type { Inputs } from "./core#8468-props.ts";
3+
4+
defineProps<P>();
5+
</script>

test/__snapshots__/fixtures-compiled.test.ts.snap

+23
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,29 @@ export { core_8286 as default };
239239
"
240240
`;
241241

242+
exports[`fixtures compiled > __fixtures__/core#8468.vue 1`] = `
243+
"import { defineComponent } from 'vue';
244+
import _export_sfc from '[NULL]/plugin-vue/export-helper';
245+
246+
\\"use strict\\";
247+
var _sfc_main = /* @__PURE__ */ defineComponent({
248+
__name: \\"core#8468\\",
249+
props: {
250+
type: { type: String, required: true },
251+
value: { type: [String, Number], required: true }
252+
},
253+
setup(__props) {
254+
return () => {
255+
};
256+
}
257+
});
258+
259+
var core_8468 = /* @__PURE__ */ _export_sfc(_sfc_main, [__FILE__]);
260+
261+
export { core_8468 as default };
262+
"
263+
`;
264+
242265
exports[`fixtures compiled > __fixtures__/import-from-vue.vue 1`] = `
243266
"import { defineComponent } from 'vue';
244267
import _export_sfc from '[NULL]/plugin-vue/export-helper';

test/__snapshots__/fixtures.test.ts.snap

+12
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,18 @@ onTransitionstart: any
230230
"
231231
`;
232232
233+
exports[`fixtures > __fixtures__/core#8468.vue 1`] = `
234+
"<script setup lang=\\"ts\\" generic=\\"P extends Inputs\\">
235+
import type { Inputs } from \\"./core#8468-props.ts\\";
236+
237+
defineProps<{
238+
type: \\"number\\" | \\"text\\"
239+
value: string | number
240+
}>();
241+
</script>
242+
"
243+
`;
244+
233245
exports[`fixtures > __fixtures__/import-from-vue.vue 1`] = `
234246
"<script setup lang=\\"ts\\" generic=\\"T extends string\\">
235247
import type { Foo } from \\"./import-from-vue-vue.exclude.vue\\";

0 commit comments

Comments
 (0)