Skip to content

Commit bc9d88a

Browse files
committed
chore: add additional type checks to unit tests
1 parent eb9d5da commit bc9d88a

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

packages/form-core/tests/formOptions.test-d.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,13 @@ describe('formOptions', () => {
1616
} as Person,
1717
})
1818

19-
const form = new FormApi({
19+
const form1 = new FormApi(formOpts)
20+
const form2 = new FormApi({
2021
...formOpts,
2122
})
2223

23-
expectTypeOf(form.state.values).toEqualTypeOf<Person>()
24+
expectTypeOf(form1.state.values).toEqualTypeOf<Person>()
25+
expectTypeOf(form2.state.values).toEqualTypeOf<Person>()
2426
})
2527

2628
it('types should be properly inferred when passing args alongside formOptions', () => {
@@ -66,6 +68,9 @@ describe('formOptions', () => {
6668
} as Person,
6769
})
6870

71+
const formOnly = new FormApi(formOpts)
72+
expectTypeOf(formOnly.state.values).toEqualTypeOf<Person>()
73+
6974
const form = new FormApi({
7075
...formOpts,
7176
defaultValues: {
@@ -95,6 +100,9 @@ describe('formOptions', () => {
95100
expectTypeOf(meta).toEqualTypeOf<SubmitMeta>()
96101
},
97102
})
103+
104+
const form = new FormApi(formOpts)
105+
const form2 = new FormApi({ ...formOpts })
98106
})
99107

100108
it('types should infer validator types', () => {

0 commit comments

Comments
 (0)