Skip to content
Merged
Show file tree
Hide file tree
Changes from 43 commits
Commits
Show all changes
96 commits
Select commit Hold shift + click to select a range
44a71cf
chore: WIP adding in inferencing to validator's return type
crutchcorn Jan 9, 2025
d9ef915
chore: more work on fixing types
crutchcorn Jan 9, 2025
8b87404
chore: wip on things more
crutchcorn Jan 9, 2025
d2544c7
chore: fix issues with FormApi and FieldApi
crutchcorn Jan 9, 2025
9c1caef
chore: add more fields to infer
crutchcorn Jan 9, 2025
901efb3
chore: change typed from unknown to undefined
crutchcorn Jan 9, 2025
9b18dbd
chore: more fixes
crutchcorn Jan 9, 2025
97767f4
chore: add some new type tests
crutchcorn Jan 9, 2025
5263c16
chore: add more type tests
crutchcorn Jan 9, 2025
e321a09
ci: apply automated fixes and generate docs
autofix-ci[bot] Jan 9, 2025
05e3e99
chore: migrate React components to use new prop types
crutchcorn Jan 9, 2025
00963bd
chore: move useTransform hook to new types
crutchcorn Jan 9, 2025
be575af
chore: add convinience type for AnyFormAPI and AnyFieldAPI
crutchcorn Jan 9, 2025
f2e0d00
ci: apply automated fixes and generate docs
autofix-ci[bot] Jan 9, 2025
6de25f3
chore: fix NextJS and Remix adapters
crutchcorn Jan 9, 2025
65c31b6
chore: fix build of Start adapter
crutchcorn Jan 9, 2025
e902f69
ci: apply automated fixes and generate docs
autofix-ci[bot] Jan 9, 2025
0035012
ci: apply automated fixes and generate docs
autofix-ci[bot] Jan 9, 2025
64cfbe0
chore: fix issues with Nx on Windows
crutchcorn Jan 10, 2025
0c7cdbe
chore: fix issues with FieldAny in examples
crutchcorn Jan 10, 2025
d3758c0
chore: upgrade React packages to stable
crutchcorn Jan 10, 2025
1a196a5
chore: WIP attempt to fix Start package
crutchcorn Jan 10, 2025
29c25b3
chore: fix mergeForm typing
crutchcorn Jan 10, 2025
b91fc72
ci: apply automated fixes and generate docs
autofix-ci[bot] Jan 10, 2025
5d21496
chore: migrate Angular adapter to use new API
crutchcorn Jan 10, 2025
035ae35
ci: apply automated fixes and generate docs
autofix-ci[bot] Jan 10, 2025
70a644c
chore: migrate Lit adapter to new generics
crutchcorn Jan 11, 2025
eb942ec
ci: apply automated fixes and generate docs
autofix-ci[bot] Jan 11, 2025
98fd587
chore: attempt 1 at fixing Vue's types
crutchcorn Jan 11, 2025
074f9a4
chore: fix Vue types for JSX and Vue SFCs alike
crutchcorn Jan 11, 2025
2e9f16d
chore: migrate Vue type to use new generics
crutchcorn Jan 11, 2025
ae2609e
chore: fix Vue test types
crutchcorn Jan 11, 2025
5600797
chore: fix Vue examples
crutchcorn Jan 11, 2025
af991ec
ci: apply automated fixes and generate docs
autofix-ci[bot] Jan 11, 2025
4604b41
chore: migrate Solid to new generics system
crutchcorn Jan 11, 2025
ac698c8
chore: fix Solid examples
crutchcorn Jan 11, 2025
c9ea6cf
ci: apply automated fixes and generate docs
autofix-ci[bot] Jan 11, 2025
69c1897
ci: apply automated fixes and generate docs (attempt 2/3)
autofix-ci[bot] Jan 11, 2025
1798a88
chore: fix issues with Solid library
crutchcorn Jan 12, 2025
4138729
chore: fix knip
crutchcorn Jan 12, 2025
1b46420
chore: fix issues with error casting
crutchcorn Jan 12, 2025
56f813a
chore: fix issue with ESLint
crutchcorn Jan 12, 2025
a5d41db
docs: show errorMap and errorarray
crutchcorn Jan 12, 2025
57198cb
Merge branch 'main' into return-anything-not-just-string
crutchcorn Jan 15, 2025
dcd8e3b
chore: upgrade all deps
crutchcorn Jan 15, 2025
0d40105
ci: apply automated fixes and generate docs
autofix-ci[bot] Jan 15, 2025
0d966a7
Merge branch 'main' into return-anything-not-just-string
crutchcorn Feb 5, 2025
5465cb7
ci: apply automated fixes and generate docs
autofix-ci[bot] Feb 5, 2025
e9886b9
chore: address PR feedback
crutchcorn Feb 5, 2025
666314f
Merge branch 'return-anything-not-just-string' of https://github.com/…
crutchcorn Feb 5, 2025
fa83e32
ci: apply automated fixes and generate docs
autofix-ci[bot] Feb 5, 2025
37cd073
chore: fix build
crutchcorn Feb 5, 2025
27d934a
ci: apply automated fixes and generate docs
autofix-ci[bot] Feb 5, 2025
dd28f11
chore: infer from SchemaV1
crutchcorn Feb 14, 2025
9fedfa5
Merge branch 'main' into return-anything-not-just-string
crutchcorn Feb 14, 2025
cb3c44d
ci: apply automated fixes and generate docs
autofix-ci[bot] Feb 14, 2025
5f23292
chore: fix zod form adapter test
crutchcorn Feb 15, 2025
266ea98
fix: legacy validators now work as intended for fields and onChange only
crutchcorn Feb 15, 2025
c8f256d
Revert "fix: legacy validators now work as intended for fields and on…
crutchcorn Feb 15, 2025
10ce615
chore: wip migrate field away from return type to validator fn inferr…
crutchcorn Feb 15, 2025
03b7866
chore: wip handle updating meta props
crutchcorn Feb 15, 2025
6f7b32b
chore: noinfer nothing
crutchcorn Feb 15, 2025
100e55e
chore: other cleanup on the API idea
crutchcorn Feb 17, 2025
f737259
chore: revert adapter typing fix attempts
crutchcorn Feb 17, 2025
eb79999
chore: delete all form adapter codebases
crutchcorn Feb 17, 2025
afe9c4e
chore: remove now deleted packages from package.json
crutchcorn Feb 17, 2025
e086dfe
chore: remove Yup examples
crutchcorn Feb 17, 2025
abade55
feat: make standard schema return Issue objects, not a single string,…
crutchcorn Feb 17, 2025
357d8ac
chore: fix adapters types
crutchcorn Feb 17, 2025
0e6d768
chore: remove old Zod and Valibot examples
crutchcorn Feb 17, 2025
383d8da
chore: fix CI
crutchcorn Feb 17, 2025
8743a74
ci: apply automated fixes and generate docs
autofix-ci[bot] Feb 17, 2025
fe94216
chore: wip fixing issues with return types
crutchcorn Feb 17, 2025
1babf8b
chore: WIP refactor return types
crutchcorn Feb 17, 2025
557e38e
chore: add failing tests for `fields` type errors
crutchcorn Feb 17, 2025
281a6a5
chore: fix edgecase with "fields" return type
crutchcorn Feb 17, 2025
00aa775
chore: fix standard schema typing edgecase
crutchcorn Feb 17, 2025
9b35d68
ci: apply automated fixes and generate docs
autofix-ci[bot] Feb 17, 2025
b5625df
chore: fix Angular adapter's types
crutchcorn Feb 20, 2025
2326b61
ci: apply automated fixes and generate docs
autofix-ci[bot] Feb 20, 2025
d376907
chore: fix Lit adapter
crutchcorn Feb 20, 2025
bd80301
Merge branch 'return-anything-not-just-string' of https://github.com/…
crutchcorn Feb 20, 2025
de50637
ci: apply automated fixes and generate docs
autofix-ci[bot] Feb 20, 2025
b4dbdaf
chore: fix react form types, add Standard Schema support to SSR adapters
crutchcorn Feb 20, 2025
5cacd55
Merge branch 'return-anything-not-just-string' of https://github.com/…
crutchcorn Feb 20, 2025
0c60ab3
chore: fix typing problems with errors array
crutchcorn Feb 21, 2025
76c66f2
chore: fix TS types for solid
crutchcorn Feb 21, 2025
bf95c7e
chore: fix Vue TS types
crutchcorn Feb 21, 2025
fcf65a7
chore: fix CI
crutchcorn Feb 21, 2025
91a2d89
Merge branch 'main' into return-anything-not-just-string
crutchcorn Feb 21, 2025
85039de
ci: apply automated fixes and generate docs
autofix-ci[bot] Feb 21, 2025
d860383
docs: remove validatorAdapter mentions
crutchcorn Feb 21, 2025
39d64dc
ci: apply automated fixes and generate docs
autofix-ci[bot] Feb 21, 2025
41c6275
docs: improve TanStack Start docs
crutchcorn Feb 21, 2025
2c4bb17
chore: fix build artifacts
crutchcorn Feb 21, 2025
b6de203
ci: apply automated fixes and generate docs
autofix-ci[bot] Feb 21, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions docs/framework/angular/guides/validation.md
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,42 @@ export class AppComponent {
}
```

It's worth mentioning that our `errors` array and the `errorMap` matches the types returned by the validators. This means that:

```angular-ts
@Component({
selector: 'app-root',
standalone: true,
imports: [TanStackField],
template: `
<ng-container
[tanstackField]="form"
name="age"
[validators]="{
onChange: ageValidator
}"
#age="field"
>
<!-- ... -->
<!-- errorMap.onChange is type `{isOldEnough: false} | undefined` -->
<!-- meta.errors is type `Array<{isOldEnough: false} | undefined>` -->
@if (!age.api.state.meta.errorMap['onChange']?.isOldEnough) {
<em role="alert">The user is not old enough</em>
}
</ng-container>
`,
})
export class AppComponent {
ageValidator: FieldValidateFn<any, any, any, any, number> = ({ value }) =>
value < 13 ? 'You must be 13 to make an account' : undefined

// ...
}
```




## Validation at field level vs at form level

As shown above, each `[tanstackField]` accepts its own validation rules via the `onChange`, `onBlur` etc... callbacks. It is also possible to define validation rules at the form level (as opposed to field by field) by passing similar callbacks to the `injectForm()` function.
Expand Down
Loading
Loading