Skip to content

Commit fc5466f

Browse files
committed
test: add tests for vuejs/core#9541
1 parent e8b77bc commit fc5466f

File tree

3 files changed

+49
-1
lines changed

3 files changed

+49
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<script setup lang="ts">
2+
interface Base {
3+
(e: "change", id: number): void;
4+
}
5+
interface Emits extends Base {
6+
(e: "unChange", id: number): void;
7+
}
8+
const emit = defineEmits<Emits>();
9+
10+
emit("change", 1);
11+
</script>

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

+22
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,28 @@ export { basic as default };
2020
"
2121
`;
2222

23+
exports[`fixtures compiled > __fixtures__/defineEmits/core#9541.vue 1`] = `
24+
"import { defineComponent } from 'vue';
25+
import _export_sfc from '[NULL]/plugin-vue/export-helper';
26+
27+
\\"use strict\\";
28+
var _sfc_main = /* @__PURE__ */ defineComponent({
29+
__name: \\"core#9541\\",
30+
emits: [\\"unChange\\", \\"change\\"],
31+
setup(__props, { emit: __emit }) {
32+
const emit = __emit;
33+
emit(\\"change\\", 1);
34+
return () => {
35+
};
36+
}
37+
});
38+
39+
var core_9541 = /* @__PURE__ */ _export_sfc(_sfc_main, [__FILE__]);
40+
41+
export { core_9541 as default };
42+
"
43+
`;
44+
2345
exports[`fixtures compiled > __fixtures__/defineEmits/shorthand.vue 1`] = `
2446
"import { defineComponent } from 'vue';
2547
import _export_sfc from '[NULL]/plugin-vue/export-helper';

test/__snapshots__/fixtures.test.ts.snap

+16-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,21 @@ defineEmits([\\"foo\\", \\"baz\\", \\"qux\\", \\"quote\\\\\\"\\"]);
99
"
1010
`;
1111
12+
exports[`fixtures > __fixtures__/defineEmits/core#9541.vue 1`] = `
13+
"<script setup lang=\\"ts\\">
14+
interface Base {
15+
(e: \\"change\\", id: number): void;
16+
}
17+
interface Emits extends Base {
18+
(e: \\"unChange\\", id: number): void;
19+
}
20+
const emit = defineEmits([\\"unChange\\", \\"change\\"]);
21+
22+
emit(\\"change\\", 1);
23+
</script>
24+
"
25+
`;
26+
1227
exports[`fixtures > __fixtures__/defineEmits/shorthand.vue 1`] = `
1328
"<script setup lang=\\"ts\\">
1429
import type { Events } from \\"./shorthand-ts\\";
@@ -34,7 +49,7 @@ stringUnion: \\"a\\" | \\"b\\"
3449
genericExtendsString: string
3550
array: string[]
3651
genericArray: (string | number)[]
37-
genericCondition: 1 | \\"a\\"
52+
genericCondition: \\"a\\" | 1
3853
function: () => void
3954
error: Error
4055
} & {

0 commit comments

Comments
 (0)