Skip to content

Commit dfaeca1

Browse files
committed
test: Add test case for primitive factories
1 parent ab1ec2d commit dfaeca1

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

test-dts/setupHelpers.test-d.ts

+7-2
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,14 @@ describe('defineProps w/ type declaration + withDefaults', () => {
2828
obj?: { x: number }
2929
fn?: (e: string) => void
3030
x?: string
31+
genStr?: string
3132
}>(),
3233
{
3334
number: 123,
3435
arr: () => [],
3536
obj: () => ({ x: 123 }),
36-
fn: () => {}
37+
fn: () => {},
38+
genStr: () => ''
3739
}
3840
)
3941

@@ -43,6 +45,7 @@ describe('defineProps w/ type declaration + withDefaults', () => {
4345
res.fn('hi')
4446
// @ts-expect-error
4547
res.x.slice()
48+
res.genStr.slice()
4649
})
4750

4851
describe('defineProps w/ union type declaration + withDefaults', () => {
@@ -51,11 +54,13 @@ describe('defineProps w/ union type declaration + withDefaults', () => {
5154
union1?: number | number[] | { x: number }
5255
union2?: number | number[] | { x: number }
5356
union3?: number | number[] | { x: number }
57+
union4?: number | number[] | { x: number }
5458
}>(),
5559
{
5660
union1: 123,
5761
union2: () => [123],
58-
union3: () => ({ x: 123 })
62+
union3: () => ({ x: 123 }),
63+
union4: () => 123,
5964
}
6065
)
6166
})

0 commit comments

Comments
 (0)