Skip to content
Source
Sign inSign up
TanStack/form
Open History to see the last commit

inject-store.ts

13 lines486 Bytes

1import { injectStore as injectAngularStore } from '@tanstack/angular-store'
2import type { FormApi, FormState, Validator } from '@tanstack/form-core'
3​
4export function injectStore<
5 TFormData,
6 TFormValidator extends Validator<TFormData, unknown> | undefined = undefined,
7 TSelected = NoInfer<FormState<TFormData>>,
8>(
9 form: FormApi<TFormData, TFormValidator>,
10 selector?: (state: NoInfer<FormState<TFormData>>) => TSelected,
11) {
12 return injectAngularStore(form.store, selector)