-
-
Notifications
You must be signed in to change notification settings - Fork 228
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
Elevate @types/json-schema to dependency #227
Comments
Hey @ASDFGerte. |
Possible, but i am not too sure about your conventions, and apart from changes to the lock file, it's basically just the following in
I typically use yarn, and am on NPM 7 otherwise, which would e.g. bump your |
Yup, the diff looks good. |
This is closely related to #175.
The issue is, that the type declarations for this project depend on
@types/json-schema
(they import), but the package is only listed as dev-dependency. The consumer of@apidevtools/json-schema-ref-parser
reads its type declarations, which need@types/json-schema
, and it therefore should be a normal dependency.In NPM, this may slip through the cracks (maybe need to manually install
@types/json-schema
as dev-dependency, in the consuming project. Afterwards, there simply are no checks for being listed as dependency, when importing - it just looks intonode_modules
). However, on yarn 2, with strict pnp, this simply doesn't work. Typescript won't resolve the imported types, turning them all toany
, which will make all types that depend on the import useless.A work-around is to have yarn inject the missing dependency:
An alternative solution i can think of, should having types as dependency really be a problem, would be having a separate package
@types/json-schema-ref-parser
, which consumers manually add as dev-dependency in their own project.The text was updated successfully, but these errors were encountered: