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

Installs typings for packages already providing internal typings #24

Closed
lucsky opened this issue Mar 5, 2019 · 6 comments · Fixed by #27
Closed

Installs typings for packages already providing internal typings #24

lucsky opened this issue Mar 5, 2019 · 6 comments · Fixed by #27

Comments

@lucsky
Copy link

lucsky commented Mar 5, 2019

Example from a test I just did: i18next (https://github.com/i18next/i18next) or (https://github.com/oblador/react-native-keychain).

@jeffijoe
Copy link
Owner

jeffijoe commented Mar 5, 2019

How do you propose we avoid this? knex has the same problem, it ships it's own typings and also has typings on DT.

@lucsky
Copy link
Author

lucsky commented Mar 5, 2019

Well, ideally npm or yarn would provide a way to remotely query the targeted package content which would allow to parse the package.json file or look for an existing index.d.ts. But I don't think that's possible so a naive way might be to install those targeted packages outside of the current content, analyse them and only then decide if the can be brought into the package. Would make it more robust but also more slow.

@jeffijoe
Copy link
Owner

jeffijoe commented Mar 5, 2019

I think it would be safe to assume that packages are already installed when typesync is run, no?

@lucsky
Copy link
Author

lucsky commented Mar 5, 2019

Uh. Damn. Yeah that's a very good point 😁

@lucsky
Copy link
Author

lucsky commented Mar 5, 2019

But if not, npm view [NAME OF PACKAGE] types allows to query a package for typings defined in the package.json file. But you're right, it is probably safe to assume that packages are already installed which makes it much more simple.

@jeffijoe
Copy link
Owner

jeffijoe commented Mar 5, 2019

Alternatively, we can hit the registry ourselves (we already do this to fetch the latest typings info), and it seems the typings field is there! Example: https://registry.npmjs.org/awilix/3.0.0

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 a pull request may close this issue.

2 participants