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.

Broken awscdk-construct build

See original GitHub issue

Hi,

I’ve just created a new awscdk-construct project, but build is failing.

👾 build » default | node .projenrc.js
👾 build » compile | jsii --silence-warnings=reserved-word
[2022-07-01T12:11:31.392] [ERROR] jsii/compiler - Compilation errors prevented the JSII assembly from being created
node_modules/@sinclair/typebox/typebox.d.ts:237:21 - error TS2456: Type alias 'StaticIntersectReduce' circularly references itself.

237 export declare type StaticIntersectReduce<I extends unknown, T extends readonly any[]> = T extends [infer A, ...infer B] ? StaticIntersectReduce<I & A, B> : I;
                        ~~~~~~~~~~~~~~~~~~~~~
node_modules/@sinclair/typebox/typebox.d.ts:237:110 - error TS2574: A rest element type must be an array type.

237 export declare type StaticIntersectReduce<I extends unknown, T extends readonly any[]> = T extends [infer A, ...infer B] ? StaticIntersectReduce<I & A, B> : I;
                                                                                                                 ~~~~~~~~~~
node_modules/@sinclair/typebox/typebox.d.ts:237:124 - error TS2315: Type 'StaticIntersectReduce' is not generic.

237 export declare type StaticIntersectReduce<I extends unknown, T extends readonly any[]> = T extends [infer A, ...infer B] ? StaticIntersectReduce<I & A, B> : I;
                                                                                                                               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/@sinclair/typebox/typebox.d.ts:256:69 - error TS2315: Type 'StaticIntersectReduce' is not generic.

256 export declare type StaticIntersect<T extends readonly TSchema[]> = StaticIntersectReduce<unknown, StaticIntersectEvaluate<T>>;
                                                                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/@sinclair/typebox/typebox.d.ts:271:105 - error TS2574: A rest element type must be an array type.

271 export declare type StaticConstructor<T extends readonly TSchema[], U extends TSchema> = new (...args: [...StaticParameters<T>]) => Static<U>;
                                                                                                            ~~~~~~~~~~~~~~~~~~~~~~
node_modules/@sinclair/typebox/typebox.d.ts:272:98 - error TS2574: A rest element type must be an array type.

272 export declare type StaticFunction<T extends readonly TSchema[], U extends TSchema> = (...args: [...StaticParameters<T>]) => Static<U>;
                                                                                                     ~~~~~~~~~~~~~~~~~~~~~~
node_modules/@sinclair/typebox/typebox.d.ts:285:40 - error TS2574: A rest element type must be an array type.

285     Tuple<T extends TSchema[]>(items: [...T], options?: CustomOptions): TTuple<T>;
                                           ~~~~
node_modules/@sinclair/typebox/typebox.d.ts:289:44 - error TS2574: A rest element type must be an array type.

289     Intersect<T extends TSchema[]>(items: [...T], options?: IntersectOptions): TIntersect<T>;
                                               ~~~~
node_modules/@sinclair/typebox/typebox.d.ts:291:40 - error TS2574: A rest element type must be an array type.

291     Union<T extends TSchema[]>(items: [...T], options?: CustomOptions): TUnion<T>;
                                           ~~~~
node_modules/@sinclair/typebox/typebox.d.ts:323:128 - error TS2574: A rest element type must be an array type.

323     Pick<T extends TObject<TProperties> | TRef<TObject<TProperties>>, K extends SelectablePropertyKeys<T>[]>(object: T, keys: [...K], options?: ObjectOptions): TObject<Pick<SelectableProperties<T>, K[number]>>;
                                                                                                                                   ~~~~
node_modules/@sinclair/typebox/typebox.d.ts:325:128 - error TS2574: A rest element type must be an array type.

325     Omit<T extends TObject<TProperties> | TRef<TObject<TProperties>>, K extends SelectablePropertyKeys<T>[]>(object: T, keys: [...K], options?: ObjectOptions): TObject<Omit<SelectableProperties<T>, K[number]>>;
                                                                                                                                   ~~~~
node_modules/@sinclair/typebox/typebox.d.ts:329:64 - error TS2574: A rest element type must be an array type.

329     Constructor<T extends TSchema[], U extends TSchema>(args: [...T], returns: U, options?: CustomOptions): TConstructor<T, U>;
                                                                   ~~~~
node_modules/@sinclair/typebox/typebox.d.ts:331:61 - error TS2574: A rest element type must be an array type.

331     Function<T extends TSchema[], U extends TSchema>(args: [...T], returns: U, options?: CustomOptions): TFunction<T, U>;
                                                                ~~~~
node_modules/@types/jest/index.d.ts:33:29 - error TS2694: Namespace 'jest' has no exported member 'Lifecycle'.

33 declare var beforeAll: jest.Lifecycle;
                               ~~~~~~~~~
node_modules/@types/jest/index.d.ts:34:30 - error TS2694: Namespace 'jest' has no exported member 'Lifecycle'.

34 declare var beforeEach: jest.Lifecycle;
                                ~~~~~~~~~
node_modules/@types/jest/index.d.ts:35:28 - error TS2694: Namespace 'jest' has no exported member 'Lifecycle'.

35 declare var afterAll: jest.Lifecycle;
                              ~~~~~~~~~
node_modules/@types/jest/index.d.ts:36:29 - error TS2694: Namespace 'jest' has no exported member 'Lifecycle'.

36 declare var afterEach: jest.Lifecycle;
                               ~~~~~~~~~
node_modules/@types/jest/index.d.ts:37:28 - error TS2694: Namespace 'jest' has no exported member 'Describe'.

37 declare var describe: jest.Describe;
                              ~~~~~~~~
node_modules/@types/jest/index.d.ts:38:29 - error TS2694: Namespace 'jest' has no exported member 'Describe'.

38 declare var fdescribe: jest.Describe;
                               ~~~~~~~~
node_modules/@types/jest/index.d.ts:39:29 - error TS2694: Namespace 'jest' has no exported member 'Describe'.

39 declare var xdescribe: jest.Describe;
                               ~~~~~~~~
node_modules/@types/jest/index.d.ts:40:22 - error TS2694: Namespace 'jest' has no exported member 'It'.

40 declare var it: jest.It;
                        ~~
node_modules/@types/jest/index.d.ts:41:23 - error TS2694: Namespace 'jest' has no exported member 'It'.

41 declare var fit: jest.It;
                         ~~
node_modules/@types/jest/index.d.ts:42:23 - error TS2694: Namespace 'jest' has no exported member 'It'.

42 declare var xit: jest.It;
                         ~~
node_modules/@types/jest/index.d.ts:43:24 - error TS2694: Namespace 'jest' has no exported member 'It'.

43 declare var test: jest.It;
                          ~~
node_modules/@types/jest/index.d.ts:44:25 - error TS2694: Namespace 'jest' has no exported member 'It'.

44 declare var xtest: jest.It;
                           ~~
node_modules/@types/jest/index.d.ts:46:28 - error TS2694: Namespace 'jest' has no exported member 'Expect'.

46 declare const expect: jest.Expect;
                              ~~~~~~
node_modules/@types/jest/index.d.ts:416:46 - error TS7039: Mapped object type implicitly has an 'any' template type.

416     type NonFunctionPropertyNames<T> = keyof { [K in keyof T as T[K] extends Func ? never : K]: T[K]; };
                                                 ~~~~~~~~~~~~~~~
node_modules/@types/jest/index.d.ts:416:62 - error TS1005: ']' expected.

416     type NonFunctionPropertyNames<T> = keyof { [K in keyof T as T[K] extends Func ? never : K]: T[K]; };
                                                                 ~~
node_modules/@types/jest/index.d.ts:416:62 - error TS2304: Cannot find name 'as'.

416     type NonFunctionPropertyNames<T> = keyof { [K in keyof T as T[K] extends Func ? never : K]: T[K]; };
                                                                 ~~
node_modules/@types/jest/index.d.ts:416:65 - error TS1005: ';' expected.

416     type NonFunctionPropertyNames<T> = keyof { [K in keyof T as T[K] extends Func ? never : K]: T[K]; };
                                                                    ~
node_modules/@types/jest/index.d.ts:416:65 - error TS2304: Cannot find name 'T'.

416     type NonFunctionPropertyNames<T> = keyof { [K in keyof T as T[K] extends Func ? never : K]: T[K]; };
                                                                    ~
node_modules/@types/jest/index.d.ts:416:67 - error TS2304: Cannot find name 'K'.

416     type NonFunctionPropertyNames<T> = keyof { [K in keyof T as T[K] extends Func ? never : K]: T[K]; };
                                                                      ~
node_modules/@types/jest/index.d.ts:416:70 - error TS1005: ';' expected.

416     type NonFunctionPropertyNames<T> = keyof { [K in keyof T as T[K] extends Func ? never : K]: T[K]; };
                                                                         ~~~~~~~
node_modules/@types/jest/index.d.ts:416:78 - error TS2693: 'Func' only refers to a type, but is being used as a value here.

416     type NonFunctionPropertyNames<T> = keyof { [K in keyof T as T[K] extends Func ? never : K]: T[K]; };
                                                                                 ~~~~
node_modules/@types/jest/index.d.ts:416:85 - error TS2693: 'never' only refers to a type, but is being used as a value here.

416     type NonFunctionPropertyNames<T> = keyof { [K in keyof T as T[K] extends Func ? never : K]: T[K]; };
                                                                                        ~~~~~
node_modules/@types/jest/index.d.ts:416:93 - error TS2304: Cannot find name 'K'.

416     type NonFunctionPropertyNames<T> = keyof { [K in keyof T as T[K] extends Func ? never : K]: T[K]; };
                                                                                                ~
node_modules/@types/jest/index.d.ts:416:94 - error TS1005: ';' expected.

416     type NonFunctionPropertyNames<T> = keyof { [K in keyof T as T[K] extends Func ? never : K]: T[K]; };
                                                                                                 ~
node_modules/@types/jest/index.d.ts:416:95 - error TS1128: Declaration or statement expected.

416     type NonFunctionPropertyNames<T> = keyof { [K in keyof T as T[K] extends Func ? never : K]: T[K]; };
                                                                                                  ~
node_modules/@types/jest/index.d.ts:416:97 - error TS2304: Cannot find name 'T'.

416     type NonFunctionPropertyNames<T> = keyof { [K in keyof T as T[K] extends Func ? never : K]: T[K]; };
                                                                                                    ~
node_modules/@types/jest/index.d.ts:416:99 - error TS2304: Cannot find name 'K'.

416     type NonFunctionPropertyNames<T> = keyof { [K in keyof T as T[K] extends Func ? never : K]: T[K]; };
                                                                                                      ~
node_modules/@types/jest/index.d.ts:419:73 - error TS2304: Cannot find name 'NonFunctionPropertyNames'.

419     type PropertyAccessors<M extends keyof T, T extends {}> = M extends NonFunctionPropertyNames<Required<T>> ? GetAccessor | SetAccessor : never;
                                                                            ~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/@types/jest/index.d.ts:420:34 - error TS7039: Mapped object type implicitly has an 'any' template type.

420     type FunctionProperties<T> = { [K in keyof T as T[K] extends (...args: any[]) => any ? K : never]: T[K] };
                                     ~~~~~~~~~~~~~~~
node_modules/@types/jest/index.d.ts:420:50 - error TS1005: ']' expected.

420     type FunctionProperties<T> = { [K in keyof T as T[K] extends (...args: any[]) => any ? K : never]: T[K] };
                                                     ~~
node_modules/@types/jest/index.d.ts:420:50 - error TS2304: Cannot find name 'as'.

420     type FunctionProperties<T> = { [K in keyof T as T[K] extends (...args: any[]) => any ? K : never]: T[K] };
                                                     ~~
node_modules/@types/jest/index.d.ts:420:53 - error TS1005: ';' expected.

420     type FunctionProperties<T> = { [K in keyof T as T[K] extends (...args: any[]) => any ? K : never]: T[K] };
                                                        ~
node_modules/@types/jest/index.d.ts:420:53 - error TS2304: Cannot find name 'T'.

420     type FunctionProperties<T> = { [K in keyof T as T[K] extends (...args: any[]) => any ? K : never]: T[K] };
                                                        ~
node_modules/@types/jest/index.d.ts:420:55 - error TS2304: Cannot find name 'K'.

420     type FunctionProperties<T> = { [K in keyof T as T[K] extends (...args: any[]) => any ? K : never]: T[K] };
                                                          ~
node_modules/@types/jest/index.d.ts:420:58 - error TS1005: ';' expected.

420     type FunctionProperties<T> = { [K in keyof T as T[K] extends (...args: any[]) => any ? K : never]: T[K] };
                                                             ~~~~~~~
node_modules/@types/jest/index.d.ts:420:86 - error TS2693: 'any' only refers to a type, but is being used as a value here.

420     type FunctionProperties<T> = { [K in keyof T as T[K] extends (...args: any[]) => any ? K : never]: T[K] };
                                                                                         ~~~
node_modules/@types/jest/index.d.ts:420:92 - error TS2304: Cannot find name 'K'.

420     type FunctionProperties<T> = { [K in keyof T as T[K] extends (...args: any[]) => any ? K : never]: T[K] };
                                                                                               ~
node_modules/@types/jest/index.d.ts:420:96 - error TS2693: 'never' only refers to a type, but is being used as a value here.

420     type FunctionProperties<T> = { [K in keyof T as T[K] extends (...args: any[]) => any ? K : never]: T[K] };
                                                                                                   ~~~~~
node_modules/@types/jest/index.d.ts:420:101 - error TS1005: ';' expected.

420     type FunctionProperties<T> = { [K in keyof T as T[K] extends (...args: any[]) => any ? K : never]: T[K] };
                                                                                                        ~
node_modules/@types/jest/index.d.ts:420:102 - error TS1128: Declaration or statement expected.

420     type FunctionProperties<T> = { [K in keyof T as T[K] extends (...args: any[]) => any ? K : never]: T[K] };
                                                                                                         ~
node_modules/@types/jest/index.d.ts:420:104 - error TS2304: Cannot find name 'T'.

420     type FunctionProperties<T> = { [K in keyof T as T[K] extends (...args: any[]) => any ? K : never]: T[K] };
                                                                                                           ~
node_modules/@types/jest/index.d.ts:420:106 - error TS2304: Cannot find name 'K'.

420     type FunctionProperties<T> = { [K in keyof T as T[K] extends (...args: any[]) => any ? K : never]: T[K] };
                                                                                                             ~
node_modules/@types/jest/index.d.ts:420:109 - error TS1128: Declaration or statement expected.

420     type FunctionProperties<T> = { [K in keyof T as T[K] extends (...args: any[]) => any ? K : never]: T[K] };
                                                                                                                ~
node_modules/@types/jest/index.d.ts:422:71 - error TS2304: Cannot find name 'Constructor'.

422     type ConstructorPropertyNames<T> = { [K in keyof T]: T[K] extends Constructor ? K : never }[keyof T] &
                                                                          ~~~~~~~~~~~
node_modules/@types/jest/index.d.ts:530:63 - error TS2304: Cannot find name 'EmptyFunction'.

530         (name: number | string | Function | FunctionLike, fn: EmptyFunction): void;
                                                                  ~~~~~~~~~~~~~
node_modules/@types/jest/index.d.ts:1127:88 - error TS2304: Cannot find name 'ArgsType'.

1127     type SpiedFunction<T extends (...args: any[]) => any> = SpyInstance<ReturnType<T>, ArgsType<T>>;
                                                                                            ~~~~~~~~
node_modules/@types/jest/index.d.ts:1140:90 - error TS2304: Cannot find name 'ArgsType'.

1140     type MockedFunction<T extends (...args: any[]) => any> = MockInstance<ReturnType<T>, ArgsType<T>> & T;
                                                                                              ~~~~~~~~
node_modules/@types/jest/index.d.ts:1176:46 - error TS2304: Cannot find name 'ArgsType'.

1176             ? MockInstance<ReturnType<T[P]>, ArgsType<T[P]>>
                                                  ~~~~~~~~
node_modules/@types/jest/index.d.ts:1292:34 - error TS2304: Cannot find name 'ResolvedValue'.

1292         mockResolvedValue(value: ResolvedValue<T>): this;
                                      ~~~~~~~~~~~~~
node_modules/@types/jest/index.d.ts:1312:38 - error TS2304: Cannot find name 'ResolvedValue'.

1312         mockResolvedValueOnce(value: ResolvedValue<T>): this;
                                          ~~~~~~~~~~~~~
node_modules/@types/jest/index.d.ts:1324:34 - error TS2304: Cannot find name 'RejectedValue'.

1324         mockRejectedValue(value: RejectedValue<T>): this;
                                      ~~~~~~~~~~~~~
node_modules/@types/jest/index.d.ts:1342:38 - error TS2304: Cannot find name 'RejectedValue'.

1342         mockRejectedValueOnce(value: RejectedValue<T>): this;
                                          ~~~~~~~~~~~~~
node_modules/@types/jest/index.d.ts:1379:1 - error TS1128: Declaration or statement expected.

1379 }
     ~
👾 Task "build » compile" failed when executing "jsii --silence-warnings=reserved-word" (cwd: [...])

Using projen v0.58.21

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:1
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
eladbcommented, Jul 3, 2022

Seems like jest 28.x needs a new version of TypeScript than the one JSII supports so this can help:

  jestOptions: {
    jestVersion: '^27.0.0', // 28 requires a later typescript version
  },

@Chriscbr @RomainMuller I suspect it might be required to make this the default for JSII projects until JSII bumps TS version.

2reactions
Chriscbrcommented, Jul 3, 2022

I think the fix proposed by @yuth in #1947 to pin jest in jsii projects makes sense. I’ve opened a new PR implementing that solution: #1966

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshooting common AWS CDK issues
This topic describes how to troubleshoot the following issues with the AWS CDK. After updating the AWS CDK, the AWS CDK Toolkit (CLI)...
Read more >
How to migrate to AWS CDK v2 - Towards the Cloud
This guide will show you how you can upgrade an existing AWS CDK v1 app to v2 without breaking its functionality…
Read more >
Simplifying Application Building with AWS Solutions ...
When a developer builds out the infrastructure for their ... Simplifying Application Building with AWS Solutions Constructs and the AWS CDK.
Read more >
A No-Nonsense Guide To AWS Cloud Development Kit (CDK)
Install AWS CLI; Install AWS CDK; Create the app; Build the app ... Essentially, you may want to break down your stacks to...
Read more >
The AWS CDK, Or Why I Stopped Being a CDK Skeptic
With CDK, you can create a Continuous Integration pipeline for the project. The pipeline, obviously using AWS CodePipeline, is quite clever. You ...
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