Skip to content

Commit 0129157

Browse files
committed
test(complex-types): add enum
1 parent 7dc3e97 commit 0129157

File tree

3 files changed

+25
-1
lines changed

3 files changed

+25
-1
lines changed

packages/complex-types/test/__fixtures__/defineProps/basic.vue

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@
55
>
66
import type { SomeInterface } from "./basic-ts";
77
8+
enum SomeEnum {
9+
One = "one",
10+
Two = "two",
11+
Three = 3,
12+
}
13+
814
defineProps<
915
{
1016
string: string;
@@ -21,6 +27,7 @@ defineProps<
2127
null: string | null;
2228
symbol: symbol;
2329
'quotes"': string;
30+
enum: SomeEnum;
2431
} & SomeInterface & {
2532
[MappedString in "1-1" | "1-2"]: `${MappedString}MappedType`;
2633
} & {

packages/complex-types/test/__snapshots__/fixtures-compiled.test.ts.snap

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,12 @@ exports[`fixtures compiled > __fixtures__/defineProps/basic.vue 1`] = `
9191
import { defineComponent } from 'vue';
9292
import _export_sfc from '[NULL]/plugin-vue/export-helper';
9393
94+
var SomeEnum = /* @__PURE__ */ function(SomeEnum) {
95+
SomeEnum["One"] = "one";
96+
SomeEnum["Two"] = "two";
97+
SomeEnum[SomeEnum["Three"] = 3] = "Three";
98+
return SomeEnum;
99+
}(SomeEnum || {});
94100
var _sfc_main = /* @__PURE__ */ defineComponent({
95101
__name: "basic",
96102
props: {
@@ -139,6 +145,10 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
139145
type: String,
140146
required: true
141147
},
148+
enum: {
149+
type: [String, Number],
150+
required: true
151+
},
142152
emptyInterface: {
143153
type: Object,
144154
required: true
@@ -174,7 +184,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
174184
},
175185
setup(__props, { expose: __expose }) {
176186
__expose();
177-
const __returned__ = {};
187+
const __returned__ = { SomeEnum };
178188
Object.defineProperty(__returned__, "__isScriptSetup", {
179189
enumerable: false,
180190
value: true

packages/complex-types/test/__snapshots__/fixtures.test.ts.snap

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,12 @@ exports[`fixtures > __fixtures__/defineProps/basic.vue 1`] = `
4141
>
4242
import type { SomeInterface } from "./basic-ts";
4343
44+
enum SomeEnum {
45+
One = "one",
46+
Two = "two",
47+
Three = 3,
48+
}
49+
4450
defineProps<
4551
{
4652
"string": string,
@@ -55,6 +61,7 @@ defineProps<
5561
"null": null | string,
5662
"symbol": symbol,
5763
"quotes\\"": string,
64+
"enum": string | number,
5865
} & {
5966
"emptyInterface": object,
6067
"conditionalNumber": number,

0 commit comments

Comments
 (0)