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: export types correctly #1397

Merged
merged 4 commits into from Feb 1, 2023
Merged

Conversation

christian98
Copy link
Contributor

The "exports" field of the package.json was misused for the type-declarations. Also, the type-declarations of secondary entrypoint (server.ts) of the platform packages was not generated.

Docs:

christian98 and others added 2 commits February 1, 2023 15:02
The "exports" field of the package.json was misused for the type-declarations. Also, the type-declarations of secondary entrypoint (server.ts) of the platform packages was not generated.
@jessarcher
Copy link
Member

jessarcher commented Feb 1, 2023

I've just rebased this with the latest changes from master to confirm everything is working and to get the new CI checks to run.

I've confirmed it's an improvement and fixes the issue with the server type exports (evidenced by needing to remove two @ts-expect-error directives in the Vue 3 playground 🎉)

Thanks!

@jessarcher jessarcher self-requested a review February 1, 2023 06:14
@jessarcher
Copy link
Member

It has been brought to my attention that the package.json exports is a valid way to provide type declarations, and it has priority over typesVersions.

microsoft/TypeScript#50890

I'm going to submit an alternative version of this PR that should fix the server export issues.

@jessarcher jessarcher closed this Feb 1, 2023
@jessarcher jessarcher reopened this Feb 1, 2023
@jessarcher
Copy link
Member

It appears I was too hasty in closing this PR. The exports.*.types feature is only for projects with moduleResolution set to node16 or nodenext, and while it would be nice to move towards that, I don't want it to delay this fix any longer.

@jessarcher
Copy link
Member

I've restored the exports.*.types fields, but fixed the file extension on them, and also moved them to the top of their respective sections per https://nodejs.org/api/packages.html#community-conditions-definitions

@jessarcher jessarcher merged commit 21f750b into inertiajs:master Feb 1, 2023
jessarcher added a commit that referenced this pull request Feb 1, 2023
Co-authored-by: Jess Archer <jess@jessarcher.com>
jessarcher added a commit that referenced this pull request Feb 2, 2023
Co-authored-by: Jess Archer <jess@jessarcher.com>
@christian98 christian98 deleted the fix-types branch February 2, 2023 09:08
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.

None yet

2 participants