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

fix: update package exports types #265

Merged
merged 1 commit into from
Jun 29, 2024
Merged

Conversation

happy-turtle
Copy link
Contributor

@happy-turtle happy-turtle commented Jun 26, 2024

Export the package's runtime types instead of only the module's configuration types in the package's exports field.

Types of changes

  • Bug fix (a non-breaking change which fixes an issue)
  • New feature (a non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Description

With this I want to get back to #244, which isn't quite fixed yet. Currently the package only exports the ModuleOptions types. Hence with moduleResolution type bundler (introduced with the latest Nuxt versions), it is not possible to e.g. import type { DirectusFile } from 'nuxt-directus' without type errors. This change ensures to export the runtime types instead of only the module's configuration types.

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes (if not applicable, please state why)

Tested on a local Nuxt v3.12.2 with typescriptBundlerResolution: true.

Copy link

vercel bot commented Jun 26, 2024

@happy-turtle is attempting to deploy a commit to the Conner's projects Team on Vercel.

A member of the Team first needs to authorize it.

@Intevel Intevel requested a review from sandros94 June 27, 2024 06:47
@sandros94 sandros94 self-assigned this Jun 27, 2024
@sandros94
Copy link
Collaborator

First of, thanks for opening this PR.

Indeed exporting runtime's types would be useful, but I'm afraid this is not the right way. This is mainly because of how defineNuxtModule generates schema types (if my understandings of it are correct).

But, as always, there are other options:

Considering the current structure I would go for the latter one, @happy-turtle could I ask you to do these changes?

@happy-turtle
Copy link
Contributor Author

happy-turtle commented Jun 27, 2024

That sounds pretty reasonable, thanks for your feedback. I will update the PR according to your second suggestion 👍

Copy link
Collaborator

@sandros94 sandros94 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@sandros94 sandros94 merged commit 067b243 into Intevel:main Jun 29, 2024
1 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants