-
Notifications
You must be signed in to change notification settings - Fork 80
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
Dependency Bug - @types/pino breaking typescript in consumers #417
Comments
Thanks for the report. I'll see if bumping to the next major version makes a difference and we can go from there. If you have a moment for a PR, we'd also appreciate that too. |
I don't know if that's strictly true, albeit I don't have a good argument against it right now except to say I've seen issues previously where a dependency (a type) was marked as dev but caused compilation issues of the type you're seeing, despite the types not being re-exported. I think that's because typescript will compile all types in the tree, so if the types are missing it will barf. I'll have a go at updating the dependency to the latest now and see if that helps. |
If they're not being re-exported in anyway (i.e. not referenced in any of the Here is what the pact-core
|
Thanks so much for doing the leg work on this, @RyanThomas73 !
I'm really pleased to hear this! I thought I fixed this a while ago, but I guess I must have forgotten to move the dependency (Pact used to re-export them, which caused weird compile issues - almost certainly caused by this import you found). I would have thought that it still wouldn't cause issues since Pact wasn't importing the types, but clearly I am missing something. |
New release has just gone out with the latest pino dep. Could you please check that it resolves the issue? I created a new project with a default config (e.g. I won't dig too far given you already have the setup. |
@mefellows |
Excellent, thanks! |
Software versions
Issue Checklist
Please confirm the following:
Expected behaviour
The typescript compiler works in a project that has the @pact-foundation/pact-core package installed
Actual behaviour
The typescript compiler fails with:
error TS2688: Cannot find type definition file for 'pino-std-serializers'
Steps to reproduce
tsc
commandRelevant log files
N/A
Additional Details
The problem is in separate typing libraries @types/pino + @types/pino-std-serializers that come through transitively.
NOTE: I've opened a separate issue here with them. It's uncertain at this point if the maintainers plan to address the incorrect package format directly.
pinojs/pino-std-serializers#119
The pact-js-core library is referencing
@types/pino
with an explicit version of 6.3.11pact-js-core/package.json
Line 56 in 1d98a9b
This version is problematic because it has wildcard version references:
The wildcard @types/pino-std-serializers appears to be pulling in a new 4.0.0 version that is invalid (has no index.d.ts file) and thus breaking typescript functionality. If the maintainers put out an updated 4.0.1 version that is correct the problem will resolve. But if they do not put out a fixed package or if they are slow in doing so, consumers of pact-core will continue to encounter the problem.
An ideal long term solution would be for the pact-js-core library to update to the latest major pino version which ships with it's type definitions built in and eliminate the @types/pino dependency all together.
In the short term I don't think @types/pino needs to be a dependency, I believe it can be changed to a
devDependency
.The only reason it would need to be a non dev dependency is if pact-core was re-exporting the pino types as part of the pact-core type definitions which does not appear to be the case.
Looking through the 13.12.0 package contents, for example, there is a
pino.d.ts
file in the package but it does not appear to be referenced by any of the exported type definitions and thus should be safe to change it to a devDependency` IMO.The text was updated successfully, but these errors were encountered: