-
Notifications
You must be signed in to change notification settings - Fork 507
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
fix: Move @types/generic-pool from dependencies
to devDependencies
#1563
Conversation
|
dependencies
to devDependencies
dependencies
to devDependencies
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #1563 +/- ##
==========================================
- Coverage 96.06% 92.64% -3.42%
==========================================
Files 14 86 +72
Lines 914 3874 +2960
Branches 199 705 +506
==========================================
+ Hits 878 3589 +2711
- Misses 36 285 +249 |
@@ -63,7 +64,6 @@ | |||
"dependencies": { | |||
"@opentelemetry/instrumentation": "^0.40.0", | |||
"@opentelemetry/semantic-conventions": "^1.0.0", | |||
"@types/generic-pool": "^3.1.9", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently this package actually has to be a regular dependency as a type from this package is exported publicly from the package index.d.ts
.
For end users installing this instrumentation in there application, typescript will attempt to import types from index.d.ts
, as specified in package.json
):
"types": "build/src/index.d.ts",
It will find this content in index.d.ts
:
import GenericPoolInstrumentation from './instrumentation';
export { GenericPoolInstrumentation };
export default GenericPoolInstrumentation;
//# sourceMappingURL=index.d.ts.map
And will follow import GenericPoolInstrumentation from './instrumentation';
and find the following content in instrumentation.d.ts
:
import { InstrumentationBase, InstrumentationConfig, InstrumentationNodeModuleDefinition } from '@opentelemetry/instrumentation';
import type * as genericPool from 'generic-pool';
export default class Instrumentation extends InstrumentationBase<typeof genericPool> {
private _isDisabled;
constructor(config?: InstrumentationConfig);
init(): (InstrumentationNodeModuleDefinition<typeof genericPool> | InstrumentationNodeModuleDefinition<any>)[];
private _acquirePatcher;
private _poolWrapper;
private _acquireWithCallbacksPatcher;
}
//# sourceMappingURL=instrumentation.d.ts.map
Once it hit the line
import type * as genericPool from 'generic-pool';
Typescript will emit an error as the types are missing.
You can follow this documentation to fix the issue. Basically what you need to do is to remove import type * as genericPool from 'generic-pool';
from instrumentation.ts
and replace typeof genericPool
in code with any
.
@secondfry - are you still interested in this? |
fixed in #1637 |
Which problem is this PR solving?
@opentelemetry/auto-instrumentations-node
is unusable with TypeScript 5 due to following error:Honesly, this fix is untested, but makes the most sense.
Short description of the changes
Move @types/generic-pool from
dependencies
todevDependencies
.