Skip to content

‼️ NOTICE: @types/prettier@2.6.1 breaks builds #20319

@corymhall

Description

@corymhall

Describe the bug

A recent release of @types/prettier (2.6.1) updated the minimum typescript version from 3.7 to 4.2, which is not supported.

@types/prettier is a transitive dependency

npm explain @types/prettier                                                                                                                                                       
@types/prettier@2.6.1 dev                                                                                                                                                           
node_modules/@types/prettier                                                                                                                                                        
  @types/prettier@"^2.1.5" from jest-snapshot@27.5.1                                                                                                                                
  node_modules/jest-snapshot                                                                                                                                                        
    jest-snapshot@"^27.5.1" from @jest/core@27.5.1                                                                                                                                  
    node_modules/@jest/core                                                                                                                                                         
      @jest/core@"^27.5.1" from jest@27.5.1    

Expected Behavior

No error.

Current Behavior

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

node_modules/@types/prettier/index.d.ts:41:54 - error TS2315: Type 'IsTuple' is not generic.

41 type IndexProperties<T extends { length: number }> = IsTuple<T> extends true
                                                        ~~~~~~~~~~

node_modules/@types/prettier/index.d.ts:53:6 - error TS2456: Type alias 'IsTuple' circularly references itself.

53 type IsTuple<T> = T extends [] ? true : T extends [infer First, ...infer Remain] ? IsTuple<Remain> : false;
        ~~~~~~~

node_modules/@types/prettier/index.d.ts:53:65 - error TS2574: A rest element type must be an array type.

53 type IsTuple<T> = T extends [] ? true : T extends [infer First, ...infer Remain] ? IsTuple<Remain> : false;
                                                                   ~~~~~~~~~~~~~~~

node_modules/@types/prettier/index.d.ts:53:84 - error TS2315: Type 'IsTuple' is not generic.

53 type IsTuple<T> = T extends [] ? true : T extends [infer First, ...infer Remain] ? IsTuple<Remain> : false;
                                                                                      ~~~~~~~~~~~~~~~

node_modules/@types/prettier/index.d.ts:96:5 - error TS2589: Type instantiation is excessively deep and possibly infinite.

96     call<
       ~~~~

node_modules/@types/prettier/index.d.ts:131:5 - error TS2589: Type instantiation is excessively deep and possibly infinite.

131     each<
        ~~~~

node_modules/@types/prettier/index.d.ts:165:5 - error TS2589: Type instantiation is excessively deep and possibly infinite.

165     map<
        ~~~


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

Possible Solution

Pin @types/prettier to 2.6.0 in devDependencies

package.json

{
  "devDependencies": {
    "@types/prettier": "2.6.0"
  }
}

Additional Information/Context

No response

CDK CLI Version

2.24.0

Framework Version

No response

Node.js Version

16.14.0

OS

Linux

Language

Typescript

Language Version

No response

Other information

No response

Metadata

Metadata

Assignees

Labels

bugThis issue is a bug.p0

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions