question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't compile typescript with @aws-sdk/credential-provider-web-identity

See original GitHub issue

Describe the bug

TypeScript cannot transpile @aws-sdk/credential-provider-web-identity due to TS1005 and TS1160 compiler errors.

The @aws-sdk/credential-provider-web-identity was added transitively through @aws-sdk/credential-provider-node.

Your environment

macOS

SDK version number

@aws-sdk/credential-provider-web-identity@3.38.0 @aws-sdk/credential-provider-node@3.38.0

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

Node.js

Details of the browser/Node.js/ReactNative version

v16.3.0

Steps to reproduce

  1. Add @aws-sdk/credential-provider-node to your project, transitively adding the offending module.
  2. Configure the project for typescript compilation using the tsconfig.json below.
  3. Run tsc.

Observed behavior

The compiler throws an error:

node_modules/@aws-sdk/credential-provider-web-identity/dist-types/ts3.4/fromWebToken.d.ts:21:19 - error TS1005: ']' expected.

21     [K in keyof T as `${Uncapitalize<string & K>}`]: T[K];
                     ~~

node_modules/@aws-sdk/credential-provider-web-identity/dist-types/ts3.4/fromWebToken.d.ts:21:49 - error TS1005: '(' expected.

21     [K in keyof T as `${Uncapitalize<string & K>}`]: T[K];
                                                   ~

node_modules/@aws-sdk/credential-provider-web-identity/dist-types/ts3.4/fromWebToken.d.ts:31:1 - error TS1160: Unterminated template literal.

31 
   

Expected behavior

Compilation succeeds.

Screenshots

image

Additional context

tsconfig.json

{
  "compilerOptions": {
    "target": "ES2018",
    "module": "commonjs",
    "lib": [
      "es2018"
    ],
    "importHelpers": true,
    "removeComments": true,
    "declaration": true,
    "strict": true,
    "noImplicitAny": true,
    "strictNullChecks": true,
    "noImplicitThis": true,
    "alwaysStrict": true,
    "noUnusedLocals": false,
    "noUnusedParameters": false,
    "noImplicitReturns": true,
    "noFallthroughCasesInSwitch": false,
    "inlineSourceMap": true,
    "inlineSources": true,
    "experimentalDecorators": true,
    "strictPropertyInitialization": false,
    "esModuleInterop": true,
    "allowSyntheticDefaultImports": true,
    "forceConsistentCasingInFileNames": true,
    "skipLibCheck": true,
    "noEmit": false,
    "rootDir": "src",
    "outDir": "dist"
  },
  "exclude": [
    "node_modules/*"
  ]
}

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:2
  • Comments:6

github_iconTop GitHub Comments

3reactions
gbvanrenswoudecommented, Feb 20, 2022

Best solution is to move to typescript@^4, if you cannot for some reason (e.g. project limitations), lucasfloriani created a nice patch in https://github.com/aws/aws-sdk-js-v3/pull/3121

0reactions
muneebsajjad-zameencommented, Dec 23, 2021

@vudh1 any workaround for this until it is fixed ?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Module @aws-sdk/credential-provider-web-identity
Documentation for AWS SDK for JavaScript v3.
Read more >
@aws-sdk/credential-provider-web-identity - npm
Start using @aws-sdk/credential-provider-web-identity in your project by ... TypeScript icon, indicating that this package has built-in type ...
Read more >
vitesse vue3 issue adding libraries - typescript - Stack Overflow
I'm trying to add some dependencies to vitesse with vue 3 and typescript. I added a couple of libraries ...
Read more >
Using AWS JavaScript SDK v3 in Browsers - Yiren Zhou
In this article, I will walkthrough the process of incorporating the “new” AWS JavaScript SDK in a web application, particularly how to use ......
Read more >
Building a serverless app with TypeScript - LogRocket Blog
Build a serverless application using TypeScript and the serverless framework, an open source CLI and hosted dashboard.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found