aws / aws-sdk-js-v3

Modularized AWS SDK for JavaScript.
Apache License 2.0
3.05k stars 573 forks source link

@aws-sdk/types 3.13.1 is not compatible with Typescript 3.x #2372

Closed rajivshah3 closed 3 years ago

rajivshah3 commented 3 years ago

Describe the bug

Basically the same issue as #2217. This line is not supported in Typescript 3.x: https://github.com/aws/aws-sdk-js-v3/blob/4904f6abdb9791a5abfc164504e554a2c4f0ffa9/packages/types/src/util.ts#L109

Your environment

SDK version number

@aws-sdk/types@3.13.1

Is the issue in the browser/Node.js/ReactNative?

Node.js

Details of the browser/Node.js/ReactNative version

node: v12.19.1 tsc: v3.9.9

Steps to reproduce

package.json:

{
  "dependencies": {
    "@aws-sdk/types": "^3.13.1"
  },
  "devDependencies": {
    "typescript": "^3.9.9"
  }
}

test.ts:

import '@aws-sdk/types'

Observed behavior

Running yarn && yarn tsc test.ts gives the following output:

node_modules/@aws-sdk/types/dist/types/util.d.ts:92:42 - error TS1005: ',' expected.

92 export declare type UserAgentPair = [name: string, version?: string];
                                            ~

node_modules/@aws-sdk/types/dist/types/util.d.ts:92:60 - error TS1005: ',' expected.

92 export declare type UserAgentPair = [name: string, version?: string];
                                                              ~

Found 2 errors.

Expected behavior

Should compile properly on Typescript 3.x

Additional context

The backwards-compatible types don't seem to exist at dist/types/ts3.4/util.d.ts or types/ts3.4/util.d.ts in 3.13.1. They do appear at dist/types/ts3.4/util.d.ts in 3.10.0, but I still get an error with that version. As mentioned in the linked issue, 3.6.1 works, but I haven't checked versions between 3.6.1 and 3.10.0. The backwards-compatible types exist for 3.6.1 exist at types/ts3.4/util.d.ts, so I wonder if that's the issue (in 3.10.0 they were in dist).

rajivshah3 commented 3 years ago

I manually made the change from awslabs/smithy-typescript#338 in @aws-sdk/types, ran yarn pack, and then yarn add file://path/to/tarball and yarn tsc test.ts seems to work now

richenyadav001 commented 3 years ago

Same issue i am also facing Nodejs Framework: nestjs TS : "typescript": "^3.9.7" AWS SDK: "@aws-sdk/client-s3": "^3.17.0"

Nest has another module for aws sdk but its in aws V2

tsconfig.json { "compilerOptions": { "module": "commonjs", "declaration": true, "removeComments": true, "emitDecoratorMetadata": true, "experimentalDecorators": true, "target": "es2017", "sourceMap": true, "outDir": "./dist", "baseUrl": "./", "incremental": true, "allowSyntheticDefaultImports": true, "resolveJsonModule": true }, "exclude": ["dist", "node_modules"] }

trivikr commented 3 years ago

The issue was with internal release script. Updates about the fix: https://github.com/aws/aws-sdk-js-v3/issues/2474#issuecomment-871798569

github-actions[bot] commented 3 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.