bar: { type: Number, required: false },
baz: { type: Boolean, required: true },
qux: { type: Function, required: false, default() { return 1 } },
- quux: { type: Function, required: false, default() { } }
+ quux: { type: Function, required: false, default() { } },
+ quuxx: { type: Promise, required: false, async default() { return await Promise.resolve('hi') } },
+ fred: { type: String, required: false, get default() { return 'fred' } }
},
setup(__props: any, { expose }) {
expose();
-const props = __props as { foo: string, bar?: number, baz: boolean, qux(): number, quux(): void };
+const props = __props as { foo: string, bar?: number, baz: boolean, qux(): number, quux(): void, quuxx: Promise<string>, fred: string };
baz: boolean;
qux?(): number;
quux?(): void
+ quuxx?: Promise<string>;
+ fred?: string
}>(), {
foo: 'hi',
qux() { return 1 },
- ['quux']() { }
+ ['quux']() { },
+ async quuxx() { return await Promise.resolve('hi') },
+ get fred() { return 'fred' }
})
</script>
`)
`quux: { type: Function, required: false, default() { } }`
)
expect(content).toMatch(
- `{ foo: string, bar?: number, baz: boolean, qux(): number, quux(): void }`
+ `quuxx: { type: Promise, required: false, async default() { return await Promise.resolve('hi') } }`
+ )
+ expect(content).toMatch(
+ `fred: { type: String, required: false, get default() { return 'fred' } }`
+ )
+ expect(content).toMatch(
+ `{ foo: string, bar?: number, baz: boolean, qux(): number, quux(): void, quuxx: Promise<string>, fred: string }`
)
expect(content).toMatch(`const props = __props`)
expect(bindings).toStrictEqual({
baz: BindingTypes.PROPS,
qux: BindingTypes.PROPS,
quux: BindingTypes.PROPS,
+ quuxx: BindingTypes.PROPS,
+ fred: BindingTypes.PROPS,
props: BindingTypes.SETUP_CONST
})
})