feat: export ReactFormApi for better typescript package support #868
feat: export ReactFormApi for better typescript package support #868Balastrong merged 4 commits intoTanStack:mainfrom
Conversation
☁️ Nx Cloud ReportCI is running/has finished running commands for commit 497fdac. As they complete they will appear below. Click to see the status, the terminal output, and the build insights. 📂 See all runs for this CI Pipeline Execution ✅ Successfully ran 2 targetsSent with 💌 from NxCloud. |
|
Please also export the ReactFieldApi and export them both also from the index.ts main module so that they can be consumed by users of the library. EDIT: this issue is now breaking our builds |
|
@timon-kosmoy If you need a temporary workaround and do not wish to change the code, you can do the module augmentation as follows: // <REPO>/src/augment.d.ts
// Important for module augmentation
import * as form from '@tanstack/react-form';
declare module '@tanstack/react-form' {
import { FormApi, FieldComponent } from '@tanstack/react-form';
export interface FormApi<TFormData, TFormValidator extends Validator<TFormData, unknown> | undefined = undefined> {
Field: FieldComponent<TFormData, TFormValidator>;
};
} |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #868 +/- ##
===========================================
- Coverage 91.55% 43.37% -48.19%
===========================================
Files 21 10 -11
Lines 900 83 -817
Branches 206 11 -195
===========================================
- Hits 824 36 -788
+ Misses 71 42 -29
Partials 5 5 ☔ View full report in Codecov by Sentry. |
Balastrong
left a comment
There was a problem hiding this comment.
We're probably going to export this anyway in #825 without breaking changes so let's get this merged :)
This solves the following Typescript error when building a react typescript package exporting useForm.
has or is using name 'ReactFormApi' from external module @tanstack/react-form" but cannot be named.