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

Add a exports/types field to package.json #3975

Merged
merged 1 commit into from Jul 5, 2023

Conversation

khill-fbmc
Copy link
Contributor

Forgive me if this isn't right, but don't we need to export the types as well?

Description

I was having trouble in VSCode with no type hints

Solution

Add "types": "./pyodide.d.ts" to the exports definition.

Forgive me if this isn't right, but don't we need to export the types as well?
@ryanking13
Copy link
Member

Thanks, but I think we have top-level types field which works for TypeScript I think. Is there a difference between setting types inside exports and setting it globally?

"types": "./pyodide.d.ts"

@khill-fbmc
Copy link
Contributor Author

khill-fbmc commented Jul 5, 2023

Here is a small reproduction of what I encountered:

When hovering, it gives the suggestion to modify the package.json

image

So I gave that a shot, and it cleared the error and gave me proper types:

image

image

Copy link
Member

@ryanking13 ryanking13 left a comment

Choose a reason for hiding this comment

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

Thanks for the repro @khill-fbmc! After reading the typescript docs, it looks like this is the right change.

@ryanking13 ryanking13 changed the title Update package.json Add a exports/types field to package.json Jul 5, 2023
@ryanking13 ryanking13 merged commit 1012a3f into pyodide:main Jul 5, 2023
34 of 38 checks passed
@khill-fbmc khill-fbmc deleted the patch-1 branch July 5, 2023 13:22
@khill-fbmc
Copy link
Contributor Author

Happy to help :) This is a really cool project!

@hoodmane
Copy link
Member

hoodmane commented Jul 5, 2023

Thanks @khill-fbmc!

hoodmane pushed a commit to hoodmane/pyodide that referenced this pull request Jul 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants