IBM / ibm-cos-sdk-js

ibm-cos-sdk-js
Apache License 2.0
38 stars 19 forks source link

TypeScript Compilation Errors when imported #16

Closed baxtersa closed 6 years ago

baxtersa commented 6 years ago

I have a project which imports this package as follows:

import * as AWS from 'ibm-cos-sdk';

Using TypeScript v2.3.4, I get a handful of compilation errors that types cannot be found and that namespaces don't export types. I pasted the log from typescript below. Have people seen this before? I'm on the most recent NPM package release as well.

338     Id?: NotificationId;
             ~~~~~~~~~~~~~~

node_modules/ibm-cos-sdk/clients/s3.d.ts(338,10): error TS2304: Cannot find name 'NotificationId'.

342     InvocationRole?: CloudFunctionInvocationRole;
                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/ibm-cos-sdk/clients/s3.d.ts(342,22): error TS2304: Cannot find name 'CloudFunctionInvocationRole'.

1837     GlacierJobParameters?: GlacierJobParameters;
                                ~~~~~~~~~~~~~~~~~~~~

node_modules/ibm-cos-sdk/clients/s3.d.ts(1837,28): error TS2304: Cannot find name 'GlacierJobParameters'.

1852     Expiration?: LifecycleExpiration;
                      ~~~~~~~~~~~~~~~~~~~

node_modules/ibm-cos-sdk/clients/s3.d.ts(1852,18): error TS2304: Cannot find name 'LifecycleExpiration'.

1866     NoncurrentVersionTransition?: NoncurrentVersionTransition;
                                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/ibm-cos-sdk/clients/s3.d.ts(1866,35): error TS2304: Cannot find name 'NoncurrentVersionTransition'.

1896     Destination: AnalyticsExportDestination;
                      ~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/ibm-cos-sdk/clients/s3.d.ts(1896,18): error TS2304: Cannot find name 'AnalyticsExportDestination'.

1923   export type TopicConfigurationList = TopicConfiguration[];
                                            ~~~~~~~~~~~~~~~~~~

node_modules/ibm-cos-sdk/clients/s3.d.ts(1923,40): error TS2304: Cannot find name 'TopicConfiguration'.

4   sts?: AWS.STS.Types.ClientConfiguration;
              ~~~

node_modules/ibm-cos-sdk/lib/config_service_placeholders.d.ts(4,13): error TS2694: Namespace '"/Users/baxtersa/serverless/node_modules/ibm-cos-sdk/clients/all"' has no exported member 'STS'.

8   sts?: AWS.STS.Types.apiVersion;
              ~~~

node_modules/ibm-cos-sdk/lib/config_service_placeholders.d.ts(8,13): error TS2694: Namespace '"/Users/baxtersa/serverless/node_modules/ibm-cos-sdk/clients/all"' has no exported member 'STS'.
widget- commented 6 years ago

Yep. We've recently become aware of this and are working toward a fix.

baxtersa commented 6 years ago

Awesome, thanks!

TazmanianD commented 6 years ago

I just hit this as well. I'll note that as a workaround, you can prevent TypeScript from trying to use the provided definitions by using a require instead of an import. I think it means you lose the TS info for the whole library though.

const AWS = require('ibm-cos-sdk');

widget- commented 6 years ago

A fix for this should be included in the next patch version towards the end of this month.

widget- commented 6 years ago

Should be fixed in 1.1.4. Let me know if there's any issues.