The nestjs project fails to build after upgrading @nestjs/microservices
dependency to 6.4.1 from 6.4.0. This problem still exists with 6.5.0
> rimraf dist && tsc -p tsconfig.build.json
node_modules/@nestjs/microservices/external/redis.interface.d.ts:2:23 - error TS2688: Cannot find type definition file for 'mocha'.
2 /// <reference types="mocha" />
To complete building without error.
There was a regression between v6.4.0 and v6.4.1. Either way, the reference to mocha in redis.interface.d.ts
needs to be removed. I am not sure why it is there.
/// <reference types="node" />
/// <reference types="mocha" />
export interface RetryStrategyOptions {
error: Error;
total_retry_time: number;
times_connected: number;
attempt: number;
}
Nest version: >=6.4.1 and 6.5.0
For Tooling issues:
- Node version: v10.15.0
- Platform: Mac & Linux
Others:
Yes i have the same issue.
I took a look at the file and I don't know why it even has mocha in there? @kamilmysliwiec Do you have an idea?
That is not something that @kamilmysliwiec is doing. (https://github.com/nestjs/nest/blob/master/packages/microservices/external/redis.interface.ts).
It is more Typescript compiler getting confused and assuming redis.interface.ts need a reference to mocha types.
@dynamikus I didn't think he was behind it in the first place, but I thought he might have some insight into a potential reason as to why this reference suddenly just showed up.
Doing some additional digging I have seen the NodeJS
namespace thing around and haven't relied on it. Unfortunately it seems that mocha decided to forward declare the NodeJS.EventEmitter namespace here https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/mocha/index.d.ts#L2793
So this line is the problem: https://github.com/nestjs/nest/blob/master/packages/microservices/external/redis.interface.ts#L40
Just to add something.
I compile with v6.4.0 and the line /// <reference types="mocha" />
is not added but with v6.4.1 it is added.
We must track the changes in dependencies.
The weird thing about that is that definition has been there for at least a year. My guess is that at some point tsc changed to finding references alphabetically since mocha > node.
However that's a complete guess.
Fixed in 6.5.1 :)
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Most helpful comment
Fixed in 6.5.1 :)