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

[package.json] add types in exports field #463

Merged
merged 1 commit into from
Apr 12, 2023
Merged

Conversation

thibthib
Copy link
Contributor

Starting from TS 4.7 (see release note), we need to add a types field in the exports object when then path to the .d.ts file doesn’t match the file exposed.

If it isn’t set, we have the following error:

There are types at '[...]/node_modules/yaml/dist/index.d.ts', but this result could not be resolved when respecting package.json "exports". The 'yaml' library may need to update its package.json or typings.

This should fix it by adding the same types as top level, but within the exports object

@tal-rofe
Copy link

@thibthib The issue occurs to me also. Is there WA in the mean time?

Copy link
Owner

@eemeli eemeli left a comment

Choose a reason for hiding this comment

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

Thank you! Had not noticed the TS update on this, and the proposed change looks just like should.

@thibthib
Copy link
Contributor Author

@tal-rofe The only workaround is to patch the library locally, and it will widely depend on the package manager you are using.

@eemeli Thanks for the review ! Do I need to do anything else to see this change in a new version of the library ?

@Ayc0
Copy link

Ayc0 commented Apr 12, 2023

patch the library locally, and it will widely depend on the package manager you are using.

With yarn 2+ you can use the patch: protocol (link), with pnpm you can use patchedDependencies (link), and with npm you can use the package patch-package

@eemeli eemeli merged commit 6f6b0bc into eemeli:main Apr 12, 2023
@eemeli
Copy link
Owner

eemeli commented Apr 12, 2023

@eemeli Thanks for the review ! Do I need to do anything else to see this change in a new version of the library ?

No need for further action from you. I'll release a new prerelease version shortly.

@eemeli
Copy link
Owner

eemeli commented Apr 14, 2023

There was an incompatibility with the typesVersions as well, which had been an attempt at fixing the types for the 'yaml/util' endpoint. The types should now work as intended with yaml@2.3.0-3.

@thibthib
Copy link
Contributor Author

Thanks a lot @eemeli !

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.

4 participants