Open melonmouse opened 1 year ago
This is a thread about a similar issue: https://github.com/DefinitelyTyped/DefinitelyTyped/issues/47369
installing argparse
and @types/argparse
got me versions @types/argparse@^2.0.10
and argparse@^2.0.1
using npm@9.5.1
I have read your other threads, and they are very valid, so assuming the issue exists, is it even possible to make different than the latest version as default?
The specific issue in argparse
is not current (sorry for not specifying that) - it happened at one point in time, and I'm not sure what was the root cause. All I know is that specific conditions must have existed to cause this for me, and other bugs suggest it is not an entirely unique issue.
One hypothesis: could this be caused by an older version of a package being installed as a dependency (e.g. argparse@1
), and then later the user adds the types for that package without specifying the version (e.g. @types/argparse
) which is resolved to the newest and incompatible version (e.g. @types/argparse@2
). If that is the cause, I suspect adding a peerDependency
between a package and its types would at the very least inform the user about the mismatch, instead of getting a runtime error down the line.
tl;dr: should a
peerDependency
between a package and it's type package be required? That could avoid automatically getting incompatible versions of a package and it's type dependency (like in the example below). From the discussion thread it seemed like this is something that is implementable in DefinitelyTyped (but I don't know if this is the case or not).Let me know if this issue is appropriate (and my apologies if it's not). Thanks for your amazing work on making typescript better!
Discussed in https://github.com/DefinitelyTyped/DefinitelyTyped/discussions/63645