Skip to content

Commit ccfd462

Browse files
committed
give up type info so that it compiles
1 parent 4890f73 commit ccfd462

File tree

2 files changed

+19
-14
lines changed

2 files changed

+19
-14
lines changed

packages/core/src/shared/awsClientBuilderV3.ts

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import { CredentialsShim } from '../auth/deprecated/loginManager'
77
import { AwsContext } from './awsContext'
88
import { AwsCredentialIdentityProvider, RetryStrategyV2 } from '@smithy/types'
9-
import { Client as IClient } from '@smithy/types'
109
import { getUserAgent } from './telemetry/util'
1110
import { DevSettings } from './settings'
1211
import {
@@ -16,6 +15,7 @@ import {
1615
HandlerExecutionContext,
1716
HttpHandlerOptions,
1817
MetadataBearer,
18+
MiddlewareStack,
1919
Provider,
2020
RetryStrategy,
2121
UserAgent,
@@ -28,13 +28,15 @@ import { extensionVersion } from '.'
2828
import { getLogger } from './logger'
2929
import { omitIfPresent } from './utilities/tsUtils'
3030
import { Client, SmithyResolvedConfiguration } from '@aws-sdk/smithy-client'
31-
export type AwsClient = IClient<object, MetadataBearer, any>
32-
export type AwsClientClass = Client<
33-
HttpHandlerOptions,
34-
any,
35-
MetadataBearer,
36-
SmithyResolvedConfiguration<HttpHandlerOptions>
37-
>
31+
32+
export type AwsClient = Client<HttpHandlerOptions, any, MetadataBearer, SmithyResolvedConfiguration<HttpHandlerOptions>>
33+
export type AwsClientConstructor<C> = new (o: AwsClientOptions) => C
34+
35+
interface AwsClient2 {
36+
middlewareStack: AwsMiddlewareStack
37+
}
38+
39+
type AwsMiddlewareStack = any
3840
interface AwsConfigOptions {
3941
credentials: AwsCredentialIdentityProvider
4042
region: string | Provider<string>
@@ -47,8 +49,8 @@ interface AwsConfigOptions {
4749
export type AwsClientOptions = AwsConfigOptions
4850

4951
export interface AWSClientBuilderV3 {
50-
createAwsService<C extends AwsClientClass>(
51-
type: new (o: AwsClientOptions) => C,
52+
createAwsService<C extends AwsClient2>(
53+
type: AwsClientConstructor<C>,
5254
options?: Partial<AwsClientOptions>,
5355
region?: string,
5456
userAgent?: boolean,
@@ -67,8 +69,8 @@ export class DefaultAWSClientBuilderV3 implements AWSClientBuilderV3 {
6769
return shim
6870
}
6971

70-
public async createAwsService<C extends AwsClientClass>(
71-
type: new (o: AwsClientOptions) => C,
72+
public async createAwsService<C extends AwsClient2>(
73+
type: AwsClientConstructor<C>,
7274
options?: Partial<AwsClientOptions>,
7375
region?: string,
7476
userAgent: boolean = true,

packages/core/src/test/shared/defaultAwsClientBuilderV3.test.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ import { FakeMemento } from '../fakeExtensionContext'
1010
import { FakeAwsContext } from '../utilities/fakeAwsContext'
1111
import { GlobalState } from '../../shared/globalState'
1212
import {
13-
AWSClientBuilderV3,
13+
AwsClient,
14+
AwsClientConstructor,
1415
DefaultAWSClientBuilderV3,
1516
getServiceId,
1617
recordErrorTelemetry,
@@ -19,12 +20,14 @@ import { Client } from '@aws-sdk/smithy-client'
1920
import { extensionVersion } from '../../shared'
2021
import { assertTelemetry } from '../testUtil'
2122
import { telemetry } from '../../shared/telemetry'
23+
import { CloudFormationClient } from '@aws-sdk/client-cloudformation'
2224

2325
describe('DefaultAwsClientBuilderV3', function () {
24-
let builder: AWSClientBuilderV3
26+
let builder: DefaultAWSClientBuilderV3
2527

2628
beforeEach(async function () {
2729
builder = new DefaultAWSClientBuilderV3(new FakeAwsContext())
30+
const c = await builder.createAwsService(CloudFormationClient, undefined, 'us-east-1')
2831
})
2932

3033
describe('createAndConfigureSdkClient', function () {

0 commit comments

Comments
 (0)