Closed michaelklem closed 2 years ago
@michaelklem Thanks for reporting and resolving! I confirm the error you found, and I confirm that your solution fixes the error.
We upgraded to Mongoose v6 in our May/June 2022 book update. I missed making proper changes to slugify.test.js
. I appreciate that you caught it.
In the slugify.test.ts file, the following options are no longer supported: const options = { useNewUrlParser: true, useCreateIndex: true, useFindAndModify: false, useUnifiedTopology: true, };
See mongoose 6 documentation
Commenting out the options results in passing tests.
Original code results in these errors: test/server/utils/slugify.test.ts:17:56 - error TS2769: No overload matches this call. Overload 1 of 3, '(uri: string, callback: CallbackWithoutResult): void', gave the following error. Argument of type '{ useNewUrlParser: boolean; useCreateIndex: boolean; useFindAndModify: boolean; useUnifiedTopology: boolean; }' is not assignable to parameter of type 'CallbackWithoutResult'. Type '{ useNewUrlParser: boolean; useCreateIndex: boolean; useFindAndModify: boolean; useUnifiedTopology: boolean; }' provides no match for the signature '(error: NativeError): void'. Overload 2 of 3, '(uri: string, options?: ConnectOptions): Promise<typeof import("mongoose")>', gave the following error. Type '{ useNewUrlParser: boolean; useCreateIndex: boolean; useFindAndModify: boolean; useUnifiedTopology: boolean; }' has no properties in common with type 'ConnectOptions'.
I tested with the code in the 4-end directory.