Ionic Pro build: customised AWS-SDK module required

Using the JS AWS-SDK in typescript.

AWS.config.credentials has type defined as Credentials | CredentialsOptions | null in AWS’s docs, however on compilation we get:

Property ‘refresh’ does not exist on type ‘Credentials | CredentialsOptions’. Property ‘refresh’ does not
exist on type ‘CredentialsOptions’.

Normally I “fix” this by removing CredentialsOptions|null from the type definition after the first NPM install so it just defines against Credentials, (refresh() is really the most useful method in it). However, with the Ionic Pro Build, one cannot do this so builds error.

Is there a way to use our own node_modules (similar to in AWS Lambda) or should I stick with redefining AWS.config.credentials as any ?

const AWSCredentials: any = AWS.config.credentials
AWSCredentials.refresh()