MitchelSt / react-testing-starter

Part of the "React Testing Crash Course" taught by Mitchel from Techbase
https://www.youtube.com/watch?v=OVNjsIto9xM
MIT License
123 stars 242 forks source link

TS unable to compile #1

Closed ManuC84 closed 3 years ago

ManuC84 commented 3 years ago

Followed the instructions to a T but it keeps giving TS errors

[start:api:watch] [start:api:watch] C:\react-testing-starter\node_modules\ts-node\src\index.ts:587 [start:api:watch] return new TSError(diagnosticText, diagnosticCodes); [start:api:watch] ^ [start:api:watch] TSError: ⨯ Unable to compile TypeScript: [start:api:watch] backend/app.ts(79,11): error TS2769: No overload matches this call. [start:api:watch] The last overload gave the following error. [start:api:watch] Argument of type 'RequestHandler<ParamsDictionary, any, any, ParsedQs, Record<string, any>>' is not assignable to parameter of type 'PathParams'. [start:api:watch] Type 'RequestHandler<ParamsDictionary, any, any, ParsedQs, Record<string, any>>' is missing the following properties from type '(string | RegExp)[]': pop, push, concat, join, and 27 more. [start:api:watch] backend/app.ts(89,11): error TS2769: No overload matches this call. [start:api:watch] The last overload gave the following error. [start:api:watch] Argument of type 'RequestHandler<ParamsDictionary, any, any, ParsedQs, Record<string, any>>' is not assignable to parameter of type 'PathParams'. [start:api:watch] Type 'RequestHandler<ParamsDictionary, any, any, ParsedQs, Record<string, any>>' is not assignable to type '(string | RegExp)[]'. [start:api:watch] backend/app.ts(94,11): error TS2769: No overload matches this call. [start:api:watch] The last overload gave the following error. [start:api:watch] Argument of type 'RequestHandler<ParamsDictionary, any, any, ParsedQs, Record<string, any>>' is not assignable to parameter of type 'PathParams'. [start:api:watch] Type 'RequestHandler<ParamsDictionary, any, any, ParsedQs, Record<string, any>>' is not assignable to type '(string | RegExp)[]'. [start:api:watch] [start:api:watch] at createTSError (C:\react-testing-starter\node_modules\ts-node\src\index.ts:587:12) [start:api:watch] at reportTSError (C:\react-testing-starter\node_modules\ts-node\src\index.ts:591:19) [start:api:watch] at getOutput (C:\react-testing-starter\node_modules\ts-node\src\index.ts:921:36) [start:api:watch] at Object.compile (C:\react-testing-starter\node_modules\ts-node\src\index.ts:1189:32) [start:api:watch] at Module.m._compile (C:\react-testing-starter\node_modules\ts-node\src\index.ts:1295:42) [start:api:watch] at module.exports (C:\react-testing-starter\node_modules\default-require-extensions\js.js:7:9) [start:api:watch] at C:\react-testing-starter\node_modules\append-transform\index.js:64:4 [start:api:watch] at require.extensions.<computed> (C:\react-testing-starter\node_modules\ts-node\src\index.ts:1298:12) [start:api:watch] at Object.<anonymous> (C:\react-testing-starter\node_modules\append-transform\index.js:64:4) [start:api:watch] at Module.load (internal/modules/cjs/loader.js:928:32)

MitchelSt commented 3 years ago

I saw your YouTube comment and the fix you found; awesome!

I'll just leave it here, should someone ever search trough the issues:

Had to comment out a bunch of middlewares on app.ts express file to get the app running, just in case this helps anyone

/* istanbul ignore if */
// if (process.env.REACT_APP_AUTH0) {
//   app.use(checkAuth0Jwt);
// }

/* istanbul ignore if */
// if (process.env.REACT_APP_AWS_COGNITO) {
//   app.use(checkCognitoJwt);
// }

/* istanbul ignore if */
// if (process.env.REACT_APP_GOOGLE) {
//   app.use(checkGoogleJwt);
// }