-
-
Notifications
You must be signed in to change notification settings - Fork 345
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: export ReactFormApi for better typescript package support #868
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.