Skip to content
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

Export your internal types #4409

Closed
yakudik opened this issue Aug 9, 2023 · 4 comments
Closed

Export your internal types #4409

yakudik opened this issue Aug 9, 2023 · 4 comments
Labels
👕 TypeScript TypeScript typings issue

Comments

@yakudik
Copy link

yakudik commented Aug 9, 2023

Is your feature request related to a problem? Please describe.

I am developing a component library for my company and making a small wrapper around the useForm composable, but i've faced with one problem: vee-validate doesn't export most types/interfaces, and that is a problem because tsc just crashes with two types of errors:

  • error TS2742: The inferred type of 'useForm' cannot be named without a reference to 'vee-validate/node_modules/type-fest'. This is likely not portable. A type annotation is necessary;
  • error TS4058: Return type of exported function has or is using name 'BaseComponentBinds' from external module "<project-path>/node_modules/vee-validate/dist/vee-validate" but cannot be named

Second error concerns not only BaseComponentBinds type.

Describe the solution you'd like

Can you export your internal types, interfaces and etc?

Describe alternatives you've considered

I have no alternative for this issue

@logaretm
Copy link
Owner

The main reason we don't export all types by default is that they can undergo breaking changes at any time, they are strictly private with a few minor exceptions.

I can expose both the BaseXXXBinds but am not sure about the first error. Are you sure it is related to some types not being exported?

@yakudik
Copy link
Author

yakudik commented Aug 14, 2023

I'm sorry, the first error is really cured by adding type-fest in package.json dependencies of my project or by updating tsconfig.json (microsoft/TypeScript#29808 (comment)) and is not related to vee-validate.

For the second error. It is true that internal types can be changed in a critical way at any time, however:

  • a developer who binds to the internal types of vee-validate (or any other library) has a clear need for this and in any case takes the risks associated with this action (proportionate to how deep he climbs into the 3rd party library). It seems to me that there is nothing wrong with giving the developer this opportunity;
  • in my case, the need for export is due only to writing a wrapper around vee-validate, without having to go inside and import something other than useForm. But without the vee-validate type export, this can't be done;
  • it turns out inconsistently that vee-validate exports the composable useForm, but does not export the types associated directly with it, considering them private;

I've created a small sandbox where you can try building a minified version of the wrapper:
https://stackblitz.com/github/yakudik/vee-validate-export-check?file=package.json

@logaretm
Copy link
Owner

Sorry for the delay, I think it's fine if we expose everything so I will be doing that, but types would not be covered by semantic versioning.

@yakudik
Copy link
Author

yakudik commented Aug 28, 2023

Excuse me for the delay too. This is great news, looking forward to the release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
👕 TypeScript TypeScript typings issue
Projects
None yet
Development

No branches or pull requests

2 participants