Skip to content
This repository was archived by the owner on Jun 11, 2020. It is now read-only.
This repository was archived by the owner on Jun 11, 2020. It is now read-only.

Add inferred dependencies to peerDependencies?  #366

@sthuck

Description

@sthuck

Hi guys,

I'll start with the example scenario -
my package.json has these dependencies:

    "@types/angular": "~1.5.0",
    "@types/angular-mocks": "^1.5.0"

and @types/angular-mocks package.json looks like this, as it's dependencies are automatically inferred:

 "dependencies": {
        "@types/angular": "*"
    },

since @types/angular": "*" gets resolved to @types/angular version 1.6.23 (in Yarn 0.27.5), I end up with the types for angular 1.6. Obviously this is just an example and will happen with any type definitions that has breaking changes compared to previous type definitions.

You can see the discussion with yarn guys yarnpkg/yarn#3951, where they explain why '*' is being resolved to latest version and not simply to "any version". They suggest using peerDependencies instead, which does seem (to me at least) like the correct thing to do.

I do understand this has potential to pop up a 'missing peer dependency' error for lots and lots of people.
But if I understand this bug correctly, as time will pass and new type definitions will break previous versions, more yarn users will experience this issue. So I guess this is for your consideration...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions