Skip to content

‼️ cli: @types/babel__traverse@7.18.3 breaks builds #23126

Closed
@mrgrain

Description

@mrgrain

Status: RESOLVED

Projects using TypeScript <4.2 (like the ones created with cdk init are failing to compile due to a transitive dependency introducing a breaking change. This issue does not affect you if you are using a recent TypeScript version.

Possible Solutions

Any of the following options will work around this issue:

  • Pin @types/babel__traverse to 7.18.2 in devDependencies
    package.json
{
  "devDependencies": {
    "@types/babel__traverse": "7.18.2"
  }
}
  • Upgrade the TypeScript version to TS >=4.2

  • Create new apps with a AWS CDK CLI of version >=2.52.1 or >=1.81.1 or projen

Describe the bug

A recent release of @types/babel__traverse (7.18.3) updated the minimum typescript version to 4.2. If you have CDK apps created with cdk init and not upgraded the TypeScript version, the build will fail.

$npm ls @types/babel__traverse
cdk-app@0.1.0 
├── @types/babel__traverse@7.18.2
├─┬ jest@27.5.1
│ └─┬ @jest/core@27.5.1
│   └─┬ jest-snapshot@27.5.1
│     └── @types/babel__traverse@7.18.2 deduped
└─┬ ts-jest@27.1.5
  └─┬ babel-jest@27.5.1
    ├─┬ @types/babel__core@7.1.20
    │ └── @types/babel__traverse@7.18.2 deduped
    └─┬ babel-preset-jest@27.5.1
      └─┬ babel-plugin-jest-hoist@27.5.1
        └── @types/babel__traverse@7.18.2 deduped

Expected Behavior

No error.

Current Behavior

When trying to build a typescript app you get the error message:

$ npm run build

node_modules/@types/babel__traverse/index.d.ts:68:50 - error TS1005: ']' expected.

68 export type ArrayKeys<T> = keyof { [P in keyof T as T[P] extends any[] ? P : never]: P };
                                                    ~~

node_modules/@types/babel__traverse/index.d.ts:68:53 - error TS1005: ';' expected.

68 export type ArrayKeys<T> = keyof { [P in keyof T as T[P] extends any[] ? P : never]: P };
                                                       ~

node_modules/@types/babel__traverse/index.d.ts:68:58 - error TS1005: ';' expected.

68 export type ArrayKeys<T> = keyof { [P in keyof T as T[P] extends any[] ? P : never]: P };
                                                            ~~~~~~~

node_modules/@types/babel__traverse/index.d.ts:68:70 - error TS1011: An element access expression should take an argument.

68 export type ArrayKeys<T> = keyof { [P in keyof T as T[P] extends any[] ? P : never]: P };
                                                                        

node_modules/@types/babel__traverse/index.d.ts:68:83 - error TS1005: ';' expected.

68 export type ArrayKeys<T> = keyof { [P in keyof T as T[P] extends any[] ? P : never]: P };
                                                                                     ~

node_modules/@types/babel__traverse/index.d.ts:68:84 - error TS1128: Declaration or statement expected.

68 export type ArrayKeys<T> = keyof { [P in keyof T as T[P] extends any[] ? P : never]: P };
                                                                                      ~

node_modules/@types/babel__traverse/index.d.ts:68:88 - error TS1128: Declaration or statement expected.

68 export type ArrayKeys<T> = keyof { [P in keyof T as T[P] extends any[] ? P : never]: P };
                                                                                          ~


Found 7 errors.

Reproduction Steps

Step 1 - create a new CDK app

cdk init --language=typescript app

Step 2 - Try to build

npm run build

Additional Information/Context

No response

CDK CLI Version

<=2.52.0
<=1.18.0

Framework Version

No response

Node.js Version

14+

OS

any

Language

Typescript

Language Version

<4.2

Other information

No response

Activity

added
bugThis issue is a bug.
needs-triageThis issue or PR still needs to be triaged.
@aws-cdk/coreRelated to core CDK functionality
and removed
needs-triageThis issue or PR still needs to be triaged.
on Nov 28, 2022
changed the title [-]@types/babel__traverse@7.18.3 breaks builds[/-] [+]‼️ NOTICE: @types/babel__traverse@7.18.3 breaks builds[/+] on Nov 28, 2022
pinned this issue on Nov 28, 2022
added a commit that references this issue on Nov 28, 2022
247d0f3
github-actions

github-actions commented on Nov 28, 2022

@github-actions
Contributor

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

added a commit that references this issue on Nov 28, 2022
764b725
changed the title [-]‼️ NOTICE: @types/babel__traverse@7.18.3 breaks builds[/-] [+]‼️ @types/babel__traverse@7.18.3 breaks builds[/+] on Nov 28, 2022

15 remaining items

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    @aws-cdk/coreRelated to core CDK functionalitybugThis issue is a bug.p0

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Participants

      @mrgrain

      Issue actions

        ‼️ cli: @types/babel__traverse@7.18.3 breaks builds · Issue #23126 · aws/aws-cdk