neo
neo

Reputation: 2042

How to know which version of types package to use

I know that some npm packages don’t include types and due to that community creates @types/packagename to supply types. Since both are packages how does one know which version of types package to use with the chosen version of library package?

Upvotes: 10

Views: 2238

Answers (1)

Lauren Yim
Lauren Yim

Reputation: 14098

The major and minor version numbers of the @types/packagename package will match the major and minor version numbers of the packagename package. The patch numbers do not match: the types package will start with the patch number 0 and this will be incremented for every update to the types package for the same major/minor versions of the library.

For example, if you are using [email protected], you would install the latest @types/[email protected].

You can read more on ‘How do Definitely Typed package versions relate to versions of the corresponding library?’ on the DefinitelyTyped repository (permalink), which is where the source of the @types packages are located.

Upvotes: 12

Related Questions