jeffijoe / typesync

Install missing TypeScript typings for dependencies in your package.json.
MIT License
1.51k stars 21 forks source link

typesync Installs type dependencies which are not top level dependencies #69

Closed fragm3 closed 3 years ago

fragm3 commented 3 years ago

For "@types/testing-library__jest-dom" and "@types/testing-library__react-hooks", typesync installs these packages, these packages are not top-level dependency. They are already present in https://github.com/testing-library/jest-dom/blob/main/package.json and https://github.com/testing-library/react-hooks-testing-library/blob/master/package.json as a dependency. Can this be fixed? @jeffijoe

Using these versions:
"@testing-library/jest-dom": "^5.11.6", "@testing-library/react-hooks": "^3.7.0",

jeffijoe commented 3 years ago

You can use a config file to ignore those packages.

fragm3 commented 3 years ago

@jeffijoe can you please see the issue again,

my package.json has

    ...
    "devDependencies": {
    ...
      "@testing-library/jest-dom": "^5.11.6",
      "@testing-library/react-hooks": "^3.7.0"
    }

running typesync installs "@types/testing-libraryjest-dom" and "@types/testing-libraryreact-hooks"

jeffijoe commented 3 years ago

I guess I don't understand the problem. If you have those 2 dependencies in your package.json, why wouldn't typesync install typings for them?

fragm3 commented 3 years ago

@jeffijoe check this npm link, new type added by typesync: https://www.npmjs.com/package/@types/testing-library__react-hooks - for @testing-library/react-hooks is not needed as @testing-library/react-hooks provides its own type definitions.

jeffijoe commented 3 years ago

I haven't seen that way of "shipping typings" before. I think that is an edge case, so I suggest using the ignorePackages option.

fragm3 commented 3 years ago

@jeffijoe can this be added to the roadmap for typesync? for now adding it in ignorePackages

jeffijoe commented 3 years ago

If it turns out that many other popular packages do it this way, then I would consider it. This is the first time I see it, and if everyone did it this way then TypeSync wouldn't be necessary. :)