'nest.js build throwing a lot of errors

I have this Nest.js app running and setup for a while and, out of a sudden, it started reporting this when I run npm run build.

node_modules/@nestjs/config/dist/config.service.d.ts:1:23 - error TS2305: Module '"./types"' has no exported member 'Path'.

1 import { NoInferType, Path, PathValue } from './types';
                        ~~~~
node_modules/@nestjs/config/dist/config.service.d.ts:1:29 - error TS2305: Module '"./types"' has no exported member 'PathValue'.

1 import { NoInferType, Path, PathValue } from './types';
                              ~~~~~~~~~
node_modules/@nestjs/config/dist/types/path-value.type.d.ts:1:114 - error TS1005: '?' expected.

1 export declare type PathImpl<T, Key extends keyof T> = Key extends string ? T[Key] extends Record<string, any> ? `${Key}.${PathImpl<T[Key], Exclude<keyof T[Key], keyof any[]>> & string}` | `${Key}.${Exclude<keyof T[Key], keyof any[]> & string}` : never : never;
                                                                                                                   ~~~
node_modules/@nestjs/config/dist/types/path-value.type.d.ts:1:117 - error TS2304: Cannot find name 'Key'.

1 export declare type PathImpl<T, Key extends keyof T> = Key extends string ? T[Key] extends Record<string, any> ? `${Key}.${PathImpl<T[Key], Exclude<keyof T[Key], keyof any[]>> & string}` | `${Key}.${Exclude<keyof T[Key], keyof any[]> & string}` : never : never;
                                                                                                                      ~~~
node_modules/@nestjs/config/dist/types/path-value.type.d.ts:1:124 - error TS2693: 'PathImpl' only refers to a type, but is being used as a value here.

1 export declare type PathImpl<T, Key extends keyof T> = Key extends string ? T[Key] extends Record<string, any> ? `${Key}.${PathImpl<T[Key], Exclude<keyof T[Key], keyof any[]>> & string}` | `${Key}.${Exclude<keyof T[Key], keyof any[]> & string}` : never : never;
                                                                                                                             ~~~~~~~~
node_modules/@nestjs/config/dist/types/path-value.type.d.ts:1:133 - error TS2304: Cannot find name 'T'.

1 export declare type PathImpl<T, Key extends keyof T> = Key extends string ? T[Key] extends Record<string, any> ? `${Key}.${PathImpl<T[Key], Exclude<keyof T[Key], keyof any[]>> & string}` | `${Key}.${Exclude<keyof T[Key], keyof any[]> & string}` : never : never;
                                                                                                                                      ~
node_modules/@nestjs/config/dist/types/path-value.type.d.ts:1:135 - error TS2304: Cannot find name 'Key'.

1 export declare type PathImpl<T, Key extends keyof T> = Key extends string ? T[Key] extends Record<string, any> ? `${Key}.${PathImpl<T[Key], Exclude<keyof T[Key], keyof any[]>> & string}` | `${Key}.${Exclude<keyof T[Key], keyof any[]> & string}` : never : never;
                                                                                                                                        ~~~
node_modules/@nestjs/config/dist/types/path-value.type.d.ts:1:155 - error TS2304: Cannot find name 'T'.

1 export declare type PathImpl<T, Key extends keyof T> = Key extends string ? T[Key] extends Record<string, any> ? `${Key}.${PathImpl<T[Key], Exclude<keyof T[Key], keyof any[]>> & string}` | `${Key}.${Exclude<keyof T[Key], keyof any[]> & string}` : never : never;
                                                                                                                                                            ~
node_modules/@nestjs/config/dist/types/path-value.type.d.ts:1:157 - error TS2304: Cannot find name 'Key'.

1 export declare type PathImpl<T, Key extends keyof T> = Key extends string ? T[Key] extends Record<string, any> ? `${Key}.${PathImpl<T[Key], Exclude<keyof T[Key], keyof any[]>> & string}` | `${Key}.${Exclude<keyof T[Key], keyof any[]> & string}` : never : never;
                                                                                                                                                              ~~~
node_modules/@nestjs/config/dist/types/path-value.type.d.ts:1:177 - error TS1005: '(' expected.

1 export declare type PathImpl<T, Key extends keyof T> = Key extends string ? T[Key] extends Record<string, any> ? `${Key}.${PathImpl<T[Key], Exclude<keyof T[Key], keyof any[]>> & string}` | `${Key}.${Exclude<keyof T[Key], keyof any[]> & string}` : never : never;
                                                                                                                                                                                  ~
node_modules/@nestjs/config/dist/types/path-value.type.d.ts:1:179 - error TS2693: 'string' only refers to a type, but is being used as a value here.

1 export declare type PathImpl<T, Key extends keyof T> = Key extends string ? T[Key] extends Record<string, any> ? `${Key}.${PathImpl<T[Key], Exclude<keyof T[Key], keyof any[]>> & string}` | `${Key}.${Exclude<keyof T[Key], keyof any[]> & string}` : never : never;
                                                                                                                                                                                    ~~~~~~
node_modules/@nestjs/config/dist/types/path-value.type.d.ts:1:185 - error TS1005: ',' expected.

1 export declare type PathImpl<T, Key extends keyof T> = Key extends string ? T[Key] extends Record<string, any> ? `${Key}.${PathImpl<T[Key], Exclude<keyof T[Key], keyof any[]>> & string}` | `${Key}.${Exclude<keyof T[Key], keyof any[]> & string}` : never : never;
                                                                                                                                                                                          ~
node_modules/@nestjs/config/dist/types/path-value.type.d.ts:1:191 - error TS1005: ',' expected.

1 export declare type PathImpl<T, Key extends keyof T> = Key extends string ? T[Key] extends Record<string, any> ? `${Key}.${PathImpl<T[Key], Exclude<keyof T[Key], keyof any[]>> & string}` | `${Key}.${Exclude<keyof T[Key], keyof any[]> & string}` : never : never;
                                                                                                                                                                                                ~
node_modules/@nestjs/config/dist/types/path-value.type.d.ts:1:191 - error TS2581: Cannot find name '$'. Do you need to install type definitions for jQuery? Try `npm i @types/jquery`.

1 export declare type PathImpl<T, Key extends keyof T> = Key extends string ? T[Key] extends Record<string, any> ? `${Key}.${PathImpl<T[Key], Exclude<keyof T[Key], keyof any[]>> & string}` | `${Key}.${Exclude<keyof T[Key], keyof any[]> & string}` : never : never;
                                                                                                                                                                                                ~
node_modules/@nestjs/config/dist/types/path-value.type.d.ts:1:192 - error TS1005: ',' expected.

1 export declare type PathImpl<T, Key extends keyof T> = Key extends string ? T[Key] extends Record<string, any> ? `${Key}.${PathImpl<T[Key], Exclude<keyof T[Key], keyof any[]>> & string}` | `${Key}.${Exclude<keyof T[Key], keyof any[]> & string}` : never : never;
                                                                                                                                                                                                 ~
node_modules/@nestjs/config/dist/types/path-value.type.d.ts:1:193 - error TS18004: No value exists in scope for the shorthand property 'Key'. Either declare one or provide an initializer.

1 export declare type PathImpl<T, Key extends keyof T> = Key extends string ? T[Key] extends Record<string, any> ? `${Key}.${PathImpl<T[Key], Exclude<keyof T[Key], keyof any[]>> & string}` | `${Key}.${Exclude<keyof T[Key], keyof any[]> & string}` : never : never;
                                                                                                                                                                                                  ~~~
node_modules/@nestjs/config/dist/types/path-value.type.d.ts:1:198 - error TS2339: Property '$' does not exist on type '{ Key: any; }'.

1 export declare type PathImpl<T, Key extends keyof T> = Key extends string ? T[Key] extends Record<string, any> ? `${Key}.${PathImpl<T[Key], Exclude<keyof T[Key], keyof any[]>> & string}` | `${Key}.${Exclude<keyof T[Key], keyof any[]> & string}` : never : never;
                                                                                                                                                                                                       ~
node_modules/@nestjs/config/dist/types/path-value.type.d.ts:1:199 - error TS1005: ',' expected.

1 export declare type PathImpl<T, Key extends keyof T> = Key extends string ? T[Key] extends Record<string, any> ? `${Key}.${PathImpl<T[Key], Exclude<keyof T[Key], keyof any[]>> & string}` | `${Key}.${Exclude<keyof T[Key], keyof any[]> & string}` : never : never;
                                                                                                                                                                                                        ~
node_modules/@nestjs/config/dist/types/path-value.type.d.ts:1:199 - error TS2349: This expression is not callable.
  Type '{ [x: number]: any; Exclude<keyof, T>(): any; keyof: any; any: any; }' has no call signatures.

1 export declare type PathImpl<T, Key extends keyof T> = Key extends string ? T[Key] extends Record<string, any> ? `${Key}.${PathImpl<T[Key], Exclude<keyof T[Key], keyof any[]>> & string}` | `${Key}.${Exclude<keyof T[Key], keyof any[]> & string}` : never : never;
                                                                                                                                                                                                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/@nestjs/config/dist/types/path-value.type.d.ts:1:214 - error TS1005: ',' expected.

1 export declare type PathImpl<T, Key extends keyof T> = Key extends string ? T[Key] extends Record<string, any> ? `${Key}.${PathImpl<T[Key], Exclude<keyof T[Key], keyof any[]>> & string}` | `${Key}.${Exclude<keyof T[Key], keyof any[]> & string}` : never : never;
                                                                                                                                                                                                                       ~
node_modules/@nestjs/config/dist/types/path-value.type.d.ts:1:215 - error TS1005: ',' expected.

1 export declare type PathImpl<T, Key extends keyof T> = Key extends string ? T[Key] extends Record<string, any> ? `${Key}.${PathImpl<T[Key], Exclude<keyof T[Key], keyof any[]>> & string}` | `${Key}.${Exclude<keyof T[Key], keyof any[]> & string}` : never : never;
                                                                                                                                                                                                                        ~
node_modules/@nestjs/config/dist/types/path-value.type.d.ts:1:216 - error TS2304: Cannot find name 'Key'.

1 export declare type PathImpl<T, Key extends keyof T> = Key extends string ? T[Key] extends Record<string, any> ? `${Key}.${PathImpl<T[Key], Exclude<keyof T[Key], keyof any[]>> & string}` | `${Key}.${Exclude<keyof T[Key], keyof any[]> & string}` : never : never;
                                                                                                                                                                                                                         ~~~
node_modules/@nestjs/config/dist/types/path-value.type.d.ts:1:220 - error TS1005: ':' expected.

1 export declare type PathImpl<T, Key extends keyof T> = Key extends string ? T[Key] extends Record<string, any> ? `${Key}.${PathImpl<T[Key], Exclude<keyof T[Key], keyof any[]>> & string}` | `${Key}.${Exclude<keyof T[Key], keyof any[]> & string}` : never : never;
                                                                                                                                                                                                                             ~
node_modules/@nestjs/config/dist/types/path-value.type.d.ts:1:222 - error TS18004: No value exists in scope for the shorthand property 'keyof'. Either declare one or provide an initializer.

1 export declare type PathImpl<T, Key extends keyof T> = Key extends string ? T[Key] extends Record<string, any> ? `${Key}.${PathImpl<T[Key], Exclude<keyof T[Key], keyof any[]>> & string}` | `${Key}.${Exclude<keyof T[Key], keyof any[]> & string}` : never : never;
                                                                                                                                                                                                                               ~~~~~
node_modules/@nestjs/config/dist/types/path-value.type.d.ts:1:228 - error TS1005: ',' expected.

1 export declare type PathImpl<T, Key extends keyof T> = Key extends string ? T[Key] extends Record<string, any> ? `${Key}.${PathImpl<T[Key], Exclude<keyof T[Key], keyof any[]>> & string}` | `${Key}.${Exclude<keyof T[Key], keyof any[]> & string}` : never : never;
                                                                                                                                                                                                                                     ~~~
node_modules/@nestjs/config/dist/types/path-value.type.d.ts:1:228 - error TS2693: 'any' only refers to a type, but is being used as a value here.

1 export declare type PathImpl<T, Key extends keyof T> = Key extends string ? T[Key] extends Record<string, any> ? `${Key}.${PathImpl<T[Key], Exclude<keyof T[Key], keyof any[]>> & string}` | `${Key}.${Exclude<keyof T[Key], keyof any[]> & string}` : never : never;
                                                                                                                                                                                                                                     ~~~
node_modules/@nestjs/config/dist/types/path-value.type.d.ts:1:231 - error TS1005: ',' expected.

1 export declare type PathImpl<T, Key extends keyof T> = Key extends string ? T[Key] extends Record<string, any> ? `${Key}.${PathImpl<T[Key], Exclude<keyof T[Key], keyof any[]>> & string}` | `${Key}.${Exclude<keyof T[Key], keyof any[]> & string}` : never : never;
                                                                                                                                                                                                                                        ~
node_modules/@nestjs/config/dist/types/path-value.type.d.ts:1:232 - error TS1109: Expression expected.

1 export declare type PathImpl<T, Key extends keyof T> = Key extends string ? T[Key] extends Record<string, any> ? `${Key}.${PathImpl<T[Key], Exclude<keyof T[Key], keyof any[]>> & string}` | `${Key}.${Exclude<keyof T[Key], keyof any[]> & string}` : never : never;
                                                                                                                                                                                                                                         ~
node_modules/@nestjs/config/dist/types/path-value.type.d.ts:1:233 - error TS1005: ':' expected.

1 export declare type PathImpl<T, Key extends keyof T> = Key extends string ? T[Key] extends Record<string, any> ? `${Key}.${PathImpl<T[Key], Exclude<keyof T[Key], keyof any[]>> & string}` | `${Key}.${Exclude<keyof T[Key], keyof any[]> & string}` : never : never;
                                                                                                                                                                                                                                          ~
node_modules/@nestjs/config/dist/types/path-value.type.d.ts:1:233 - error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type.

1 export declare type PathImpl<T, Key extends keyof T> = Key extends string ? T[Key] extends Record<string, any> ? `${Key}.${PathImpl<T[Key], Exclude<keyof T[Key], keyof any[]>> & string}` | `${Key}.${Exclude<keyof T[Key], keyof any[]> & string}` : never : never;
                                                                                                                                                                                                                                          ~
node_modules/@nestjs/config/dist/types/path-value.type.d.ts:1:235 - error TS1109: Expression expected.

1 export declare type PathImpl<T, Key extends keyof T> = Key extends string ? T[Key] extends Record<string, any> ? `${Key}.${PathImpl<T[Key], Exclude<keyof T[Key], keyof any[]>> & string}` | `${Key}.${Exclude<keyof T[Key], keyof any[]> & string}` : never : never;
                                                                                                                                                                                                                                            ~
node_modules/@nestjs/config/dist/types/path-value.type.d.ts:1:237 - error TS2693: 'string' only refers to a type, but is being used as a value here.

1 export declare type PathImpl<T, Key extends keyof T> = Key extends string ? T[Key] extends Record<string, any> ? `${Key}.${PathImpl<T[Key], Exclude<keyof T[Key], keyof any[]>> & string}` | `${Key}.${Exclude<keyof T[Key], keyof any[]> & string}` : never : never;
                                                                                                                                                                                                                                              ~~~~~~
node_modules/@nestjs/config/dist/types/path-value.type.d.ts:4:66 - error TS1005: ',' expected.

4 export declare type PathValue<T, P extends Path<T>> = P extends `${infer Key}.${infer Rest}` ? Key extends keyof T ? Rest extends Path<T[Key]> ? PathValue<T[Key], Rest> : never : never : P extends keyof T ? T[P] : never;
                                                                   ~
node_modules/@nestjs/config/dist/types/path-value.type.d.ts:4:66 - error TS2581: Cannot find name '$'. Do you need to install type definitions for jQuery? Try `npm i @types/jquery`.

4 export declare type PathValue<T, P extends Path<T>> = P extends `${infer Key}.${infer Rest}` ? Key extends keyof T ? Rest extends Path<T[Key]> ? PathValue<T[Key], Rest> : never : never : P extends keyof T ? T[P] : never;
                                                                   ~
node_modules/@nestjs/config/dist/types/path-value.type.d.ts:4:67 - error TS1005: ',' expected.

4 export declare type PathValue<T, P extends Path<T>> = P extends `${infer Key}.${infer Rest}` ? Key extends keyof T ? Rest extends Path<T[Key]> ? PathValue<T[Key], Rest> : never : never : P extends keyof T ? T[P] : never;
                                                                    ~
node_modules/@nestjs/config/dist/types/path-value.type.d.ts:4:68 - error TS18004: No value exists in scope for the shorthand property 'infer'. Either declare one or provide an initializer.

4 export declare type PathValue<T, P extends Path<T>> = P extends `${infer Key}.${infer Rest}` ? Key extends keyof T ? Rest extends Path<T[Key]> ? PathValue<T[Key], Rest> : never : never : P extends keyof T ? T[P] : never;
                                                                     ~~~~~
node_modules/@nestjs/config/dist/types/path-value.type.d.ts:4:74 - error TS1005: ',' expected.

4 export declare type PathValue<T, P extends Path<T>> = P extends `${infer Key}.${infer Rest}` ? Key extends keyof T ? Rest extends Path<T[Key]> ? PathValue<T[Key], Rest> : never : never : P extends keyof T ? T[P] : never;
                                                                           ~~~
node_modules/@nestjs/config/dist/types/path-value.type.d.ts:4:74 - error TS18004: No value exists in scope for the shorthand property 'Key'. Either declare one or provide an initializer.

4 export declare type PathValue<T, P extends Path<T>> = P extends `${infer Key}.${infer Rest}` ? Key extends keyof T ? Rest extends Path<T[Key]> ? PathValue<T[Key], Rest> : never : never : P extends keyof T ? T[P] : never;
                                                                           ~~~
node_modules/@nestjs/config/dist/types/path-value.type.d.ts:4:79 - error TS2339: Property '$' does not exist on type '{ infer: any; Key: any; }'.

4 export declare type PathValue<T, P extends Path<T>> = P extends `${infer Key}.${infer Rest}` ? Key extends keyof T ? Rest extends Path<T[Key]> ? PathValue<T[Key], Rest> : never : never : P extends keyof T ? T[P] : never;
                                                                                ~
node_modules/@nestjs/config/dist/types/path-value.type.d.ts:4:80 - error TS1005: ',' expected.

4 export declare type PathValue<T, P extends Path<T>> = P extends `${infer Key}.${infer Rest}` ? Key extends keyof T ? Rest extends Path<T[Key]> ? PathValue<T[Key], Rest> : never : never : P extends keyof T ? T[P] : never;
                                                                                 ~
node_modules/@nestjs/config/dist/types/path-value.type.d.ts:4:80 - error TS2349: This expression is not callable.
  Type '{ infer: any; Rest: any; }' has no call signatures.

4 export declare type PathValue<T, P extends Path<T>> = P extends `${infer Key}.${infer Rest}` ? Key extends keyof T ? Rest extends Path<T[Key]> ? PathValue<T[Key], Rest> : never : never : P extends keyof T ? T[P] : never;
                                                                                 ~~~~~~~~~~~~
node_modules/@nestjs/config/dist/types/path-value.type.d.ts:4:81 - error TS18004: No value exists in scope for the shorthand property 'infer'. Either declare one or provide an initializer.

4 export declare type PathValue<T, P extends Path<T>> = P extends `${infer Key}.${infer Rest}` ? Key extends keyof T ? Rest extends Path<T[Key]> ? PathValue<T[Key], Rest> : never : never : P extends keyof T ? T[P] : never;
                                                                                  ~~~~~
node_modules/@nestjs/config/dist/types/path-value.type.d.ts:4:87 - error TS1005: ',' expected.

4 export declare type PathValue<T, P extends Path<T>> = P extends `${infer Key}.${infer Rest}` ? Key extends keyof T ? Rest extends Path<T[Key]> ? PathValue<T[Key], Rest> : never : never : P extends keyof T ? T[P] : never;
                                                                                        ~~~~
node_modules/@nestjs/config/dist/types/path-value.type.d.ts:4:87 - error TS18004: No value exists in scope for the shorthand property 'Rest'. Either declare one or provide an initializer.

4 export declare type PathValue<T, P extends Path<T>> = P extends `${infer Key}.${infer Rest}` ? Key extends keyof T ? Rest extends Path<T[Key]> ? PathValue<T[Key], Rest> : never : never : P extends keyof T ? T[P] : never;
                                                                                        ~~~~
node_modules/@nestjs/config/dist/types/path-value.type.d.ts:5:1 - error TS1160: Unterminated template literal.

Anyone knows how to make this go away?

All I remember doing was trying to update the nest cli on the terminal. Now, it throws these exceptions every time I ran my application.



Solution 1:[1]

Updating to NestJS 8 fixed all errors!

Solution 2:[2]

Just to add, upgrading to NestJS 8, along with upgrading TypeScript (to 4.5+) and RxJs (to 7.x) will help solve and build problems along these lines.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Luis Novo
Solution 2 Mark Pieszak - Trilon.io