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

AbbreviatedMetadata type is incorrect #62

Closed
dlqqq opened this issue Jul 24, 2021 · 4 comments · Fixed by #80
Closed

AbbreviatedMetadata type is incorrect #62

dlqqq opened this issue Jul 24, 2021 · 4 comments · Fixed by #80

Comments

@dlqqq
Copy link

dlqqq commented Jul 24, 2021

To reproduce

const metadata: AbbreviatedMetadata = await packageJson('react')
metadata.versions // actually undefined, but has type Readonly<Record<string, AbbreviatedVersion>>
metadata.version // actually a string, but has type unknown

It seems strange that the types are broken out-of-the-box. Am I doing something wrong here?

@dlqqq
Copy link
Author

dlqqq commented Jul 24, 2021

I'm on the latest version, v7.0.0.

@tutlam2019
Copy link

For how long does the funds interrupted the dev and update for the latest version?

@h4xnoodle
Copy link

He ends up doing const { version } = await packageJson(name) in another package that uses this one

@sindresorhus
Copy link
Owner

sindresorhus commented Jun 14, 2023

.versions (and probably some other properties) should be typed to only be able when {allVersions: true}.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants