Skip to content

Commit 7e92f33

Browse files
authored
Updated type declaration of captureAWSv3Client to fix TS errors (#575)
1 parent 3abe727 commit 7e92f33

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { Client } from '@aws-sdk/types';
21
import { SegmentLike } from '../aws-xray';
32
/**
43
* Instruments AWS SDK V3 clients with X-Ray via middleware.
@@ -7,4 +6,4 @@ import { SegmentLike } from '../aws-xray';
76
* @param manualSegment - Parent segment or subsegment that is passed in for manual mode users
87
* @returns - the client with the X-Ray instrumentation middleware added to its middleware stack
98
*/
10-
export declare function captureAWSClient<T extends Client<any, any, any>>(client: T, manualSegment?: SegmentLike): T
9+
export declare function captureAWSClient<T extends { middlewareStack: { remove: any, use: any }, config: any }>(client: T, manualSegment?: SegmentLike): T

packages/core/lib/patchers/aws3_p.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import {
22
Pluggable,
3-
Client,
43
BuildMiddleware,
54
MiddlewareStack,
65
BuildHandlerOptions,
@@ -189,7 +188,7 @@ const getXRayPlugin = (config: RegionResolvedConfig, manualSegment?: SegmentLike
189188
* @param manualSegment - Parent segment or subsegment that is passed in for manual mode users
190189
* @returns - the client with the X-Ray instrumentation middleware added to its middleware stack
191190
*/
192-
export function captureAWSClient<T extends Client<any, any, any>>(client: T, manualSegment?: SegmentLike): T {
191+
export function captureAWSClient<T extends { middlewareStack: { remove: any, use: any }, config: any }>(client: T, manualSegment?: SegmentLike): T {
193192
// Remove existing middleware to ensure operation is idempotent
194193
client.middlewareStack.remove(XRAY_PLUGIN_NAME);
195194
client.middlewareStack.use(getXRayPlugin(client.config, manualSegment));

0 commit comments

Comments
 (0)